Skip to content

Commit a9a683e

Browse files
committed
Fixing SIGCHLD logic in sftp and removing double close in SIGCHLD implementation
1 parent 6ec6275 commit a9a683e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

contrib/win32/win32compat/signal_sigchld.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ int waitpid(int pid, int *status, int options) {
192192

193193
ret_id = children.process_id[index];
194194
GetExitCodeProcess(process, &exit_code);
195-
CloseHandle(process);
195+
/* process handle will be closed when its removed from list */
196196
sw_remove_child_at_index(index);
197197
if (status)
198198
*status = exit_code;

sftp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2251,8 +2251,8 @@ connect_to_server(char *path, char **args, int *in, int *out)
22512251
NORMAL_PRIORITY_CLASS, NULL,
22522252
NULL, &si, &pi) == TRUE) {
22532253
sshpid = pi.dwProcessId;
2254-
CloseHandle(pi.hProcess);
22552254
CloseHandle(pi.hThread);
2255+
sw_add_child(pi.hProcess, pi.dwProcessId);
22562256
}
22572257
else
22582258
errno = GetLastError();

0 commit comments

Comments
 (0)