From a9a683ed3c56c18f5fd7fc8cecadb2dbbaeba52b Mon Sep 17 00:00:00 2001 From: manojampalam Date: Tue, 5 Apr 2016 19:19:10 -0700 Subject: [PATCH] Fixing SIGCHLD logic in sftp and removing double close in SIGCHLD implementation --- contrib/win32/win32compat/signal_sigchld.c | 2 +- sftp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/win32/win32compat/signal_sigchld.c b/contrib/win32/win32compat/signal_sigchld.c index f1401b9..afd0242 100644 --- a/contrib/win32/win32compat/signal_sigchld.c +++ b/contrib/win32/win32compat/signal_sigchld.c @@ -192,7 +192,7 @@ int waitpid(int pid, int *status, int options) { ret_id = children.process_id[index]; GetExitCodeProcess(process, &exit_code); - CloseHandle(process); + /* process handle will be closed when its removed from list */ sw_remove_child_at_index(index); if (status) *status = exit_code; diff --git a/sftp.c b/sftp.c index caaf8d1..806faf9 100644 --- a/sftp.c +++ b/sftp.c @@ -2251,8 +2251,8 @@ connect_to_server(char *path, char **args, int *in, int *out) NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi) == TRUE) { sshpid = pi.dwProcessId; - CloseHandle(pi.hProcess); CloseHandle(pi.hThread); + sw_add_child(pi.hProcess, pi.dwProcessId); } else errno = GetLastError();