--- scp.c +++ scp.c @@ -112,8 +112,10 @@ static void killchild(int signo) { - if (do_cmd_pid > 1) + if (do_cmd_pid > 1) { kill(do_cmd_pid, signo); + waitpid(do_cmd_pid, NULL, 0); + } _exit(1); } --- sftp.c +++ sftp.c @@ -144,9 +144,10 @@ static void killchild(int signo) { - if (sshpid > 1) + if (sshpid > 1) { kill(sshpid, SIGTERM); - + waitpid(sshpid, NULL, 0); + } _exit(1); }