summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2005-05-26 02:08:06 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2005-05-26 02:08:06 +0000
commit413c1aa6d80389b9c6a43830e182a034c27633eb (patch)
tree4439bd059cf190234c9c334509268a68eb7e06cf /usr.bin
parent4a64b17d3fa95518a0ef2e547d41e7cb6f5d03ce (diff)
If copying multiple files to a target file (which normally fails, as it
must be a target directory), kill the spawned ssh child before exiting. This stops it trying to authenticate and spewing lots of output. deraadt@ ok
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/scp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index 89ac354ed63..dade3a2b2b1 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.122 2005/05/24 17:32:43 avsm Exp $");
+RCSID("$OpenBSD: scp.c,v 1.123 2005/05/26 02:08:05 avsm Exp $");
#include "xmalloc.h"
#include "atomicio.h"
@@ -109,11 +109,13 @@ static void
killchild(int signo)
{
if (do_cmd_pid > 1) {
- kill(do_cmd_pid, signo);
+ kill(do_cmd_pid, signo ? signo : SIGTERM);
waitpid(do_cmd_pid, NULL, 0);
}
- _exit(1);
+ if (signo)
+ _exit(1);
+ exit(1);
}
/*
@@ -1059,7 +1061,7 @@ verifydir(char *cp)
errno = ENOTDIR;
}
run_err("%s: %s", cp, strerror(errno));
- exit(1);
+ killchild(0);
}
int