]> andersk Git - openssh.git/commitdiff
- djm@cvs.openbsd.org 2003/06/04 12:40:39
authordjm <djm>
Wed, 4 Jun 2003 12:51:24 +0000 (12:51 +0000)
committerdjm <djm>
Wed, 4 Jun 2003 12:51:24 +0000 (12:51 +0000)
     [scp.c]
     kill ssh process upon receipt of signal, bz #241.
     based on patch from esb AT hawaii.edu; ok markus@

ChangeLog
scp.c

index 88c42b88f3f8f2e4933ca27182f6d5a9aae1d690..5d87a90d037cdba84e2a7e5afffd15d410498669 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
    - djm@cvs.openbsd.org 2003/06/04 12:18:49
      [scp.c]
      ansify; ok markus@
+   - djm@cvs.openbsd.org 2003/06/04 12:40:39
+     [scp.c]
+     kill ssh process upon receipt of signal, bz #241.
+     based on patch from esb AT hawaii.edu; ok markus@
  - (djm) Update to fix of bug #584: lock card before return. 
    From larsch@trustcenter.de
 
diff --git a/scp.c b/scp.c
index 6d2692e16478149957cbbe9941159d3ca6eb870a..16734875b78fa268e89c11a5d73d58fbdb7242e6 100644 (file)
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.104 2003/06/04 12:18:49 djm Exp $");
+RCSID("$OpenBSD: scp.c,v 1.105 2003/06/04 12:40:39 djm Exp $");
 
 #include "xmalloc.h"
 #include "atomicio.h"
@@ -107,7 +107,16 @@ int showprogress = 1;
 char *ssh_program = _PATH_SSH_PROGRAM;
 
 /* This is used to store the pid of ssh_program */
-pid_t do_cmd_pid;
+pid_t do_cmd_pid = -1;
+
+static void
+killchild(int signo)
+{
+       if (do_cmd_pid > 1)
+               kill(do_cmd_pid, signo);
+
+       _exit(1);
+}
 
 /*
  * This function executes the given command as the specified user on the
@@ -170,6 +179,9 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout, int argc)
        *fdout = pin[1];
        close(pout[1]);
        *fdin = pout[0];
+       signal(SIGTERM, killchild);
+       signal(SIGINT, killchild);
+       signal(SIGHUP, killchild);
        return 0;
 }
 
This page took 0.158535 seconds and 5 git commands to generate.