Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to Issue 698 and other misc changes #208

Merged
merged 5 commits into from
Sep 22, 2017
Merged

Conversation

manojampalam
Copy link

Fix to PowerShell/Win32-OpenSSH#698 - Create job object, add ssh-shellhost and ensure all its child process and tied to its lifetime.

Other changes include changes to debug* statements in posix adapter that may cause recursion/stack overflow issues.

@@ -107,7 +107,8 @@ ReadThread(_In_ LPVOID lpParameter)

if (!ReadFile(WINHANDLE(pio), pio->read_details.buf,
pio->read_details.buf_size, &read_status.transferred, NULL)) {
read_status.error = GetLastError();
debug4("ReadThread - ReadFile failed %d, io:%p", GetLastError(), pio);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor suggest: error:%d

@@ -126,7 +127,8 @@ ReadThread(_In_ LPVOID lpParameter)
} else {
if (!ReadFile(WINHANDLE(pio), pio->read_details.buf,
pio->read_details.buf_size, &read_status.transferred, NULL)) {
read_status.error = GetLastError();
debug4("ReadThread - ReadFile failed %d, io:%p", GetLastError(), pio);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor suggest: error:%d

@@ -209,7 +211,7 @@ WriteThread(_In_ LPVOID lpParameter)
if (!WriteFile(WINHANDLE(pio), pio->write_details.buf, write_status.to_transfer,
&write_status.transferred, NULL)) {
write_status.error = GetLastError();
debug("WriteThread - ReadFile WriteFile %d, io:%p", GetLastError(), pio);
debug4("WriteThread - ReadFile WriteFile %d, io:%p", GetLastError(), pio);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ReadFile from the mesage. add error:%d

if (!SetInformationJobObject(job, JobObjectExtendedLimitInformation, &job_info, sizeof(job_info)) ||
!AssignProcessToJobObject(job, GetCurrentProcess())) {
printf_s("cannot associate job object: %d", GetLastError());
return -1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the handle is closed when process exits.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.

@manojampalam manojampalam merged commit b327f0c into latestw_all Sep 22, 2017
@manojampalam manojampalam deleted the m_changes branch September 22, 2017 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants