From 989b8a9f013eb93f27d450d2625efad8d8135d6c Mon Sep 17 00:00:00 2001 From: quamrulmina Date: Fri, 2 Oct 2015 18:35:08 -0500 Subject: [PATCH] improved sshd child monitor code to avoid annoying "broken pipe" msg from Linux clients take child detection handle out from select mux after a child process is detected to have exited so that other code exit handlings can run its course --- contrib/win32/win32compat/socket.c | 7 +++++++ serverloop.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/contrib/win32/win32compat/socket.c b/contrib/win32/win32compat/socket.c index 57083f6..9317a4b 100644 --- a/contrib/win32/win32compat/socket.c +++ b/contrib/win32/win32compat/socket.c @@ -1994,6 +1994,13 @@ int WSHELPAddChildToWatch ( HANDLE processtowatch) return 0; } +int WSHELPDelChildToWatch ( HANDLE processtowatch) +{ + if ( ChildToWatch == processtowatch ) + ChildToWatch = NULL ; + return 0; +} + int WSHELPselect(int fds, fd_set* readsfds, fd_set* writesfds, fd_set* exceptsfds, const struct timeval* timeout) { diff --git a/serverloop.c b/serverloop.c index 4063e7c..2c631f4 100644 --- a/serverloop.c +++ b/serverloop.c @@ -879,6 +879,8 @@ collect_children(void) session_close_by_pid(s->pid, status); CloseHandle(process); + int WSHELPDelChildToWatch (HANDLE processtowatch); + WSHELPDelChildToWatch (process); // take the process off from watch list in select mux } } } while (i > 0);