diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-01-24 10:22:07 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-01-24 10:22:07 +0000 |
commit | e62cc3e6a439343ba8bb508c2309623e8615b20e (patch) | |
tree | 81c4a949b487f3ada181ad848dd8afb03eb87f5b | |
parent | 625e5f755aa1c0cef661d58e876915901de4ad05 (diff) |
Have scp and sftp wait for the spawned ssh to exit before they exit
themselves. This prevents ssh from being unable to restore terminal
modes (not normally a problem on OpenBSD but common with -Portable
on POSIX platforms). From peak at argo.troja.mff.cuni.cz (bz#950);
ok djm@ markus@
-rw-r--r-- | usr.bin/ssh/scp.c | 6 | ||||
-rw-r--r-- | usr.bin/ssh/sftp.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index c7a46cdbf2b..a014442aae0 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/scp.c @@ -71,7 +71,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: scp.c,v 1.118 2004/09/15 18:46:04 deraadt Exp $"); +RCSID("$OpenBSD: scp.c,v 1.119 2005/01/24 10:22:06 dtucker Exp $"); #include "xmalloc.h" #include "atomicio.h" @@ -108,8 +108,10 @@ pid_t do_cmd_pid = -1; 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); } diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c index f8150600727..cf65266005f 100644 --- a/usr.bin/ssh/sftp.c +++ b/usr.bin/ssh/sftp.c @@ -16,7 +16,7 @@ #include "includes.h" -RCSID("$OpenBSD: sftp.c,v 1.60 2004/12/10 03:10:42 fgsch Exp $"); +RCSID("$OpenBSD: sftp.c,v 1.61 2005/01/24 10:22:06 dtucker Exp $"); #include <glob.h> #include <histedit.h> @@ -145,8 +145,10 @@ int interactive_loop(int fd_in, int fd_out, char *file1, char *file2); static void killchild(int signo) { - if (sshpid > 1) + if (sshpid > 1) { kill(sshpid, SIGTERM); + waitpid(sshpid, NULL, 0); + } _exit(1); } |