- dtucker@cvs.openbsd.org 2005/01/24 10:22:06
     [scp.c sftp.c]
     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@
diff --git a/sftp.c b/sftp.c
index 9e29cb0..31c6349 100644
--- a/sftp.c
+++ b/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 $");
 
 #ifdef USE_LIBEDIT
 #include <histedit.h>
@@ -150,8 +150,10 @@
 static void
 killchild(int signo)
 {
-	if (sshpid > 1)
+	if (sshpid > 1) {
 		kill(sshpid, SIGTERM);
+		waitpid(sshpid, NULL, 0);
+	}
 
 	_exit(1);
 }