summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/scp.c b/scp.c
index 6d2692e16..16734875b 100644
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
71 */ 71 */
72 72
73#include "includes.h" 73#include "includes.h"
74RCSID("$OpenBSD: scp.c,v 1.104 2003/06/04 12:18:49 djm Exp $"); 74RCSID("$OpenBSD: scp.c,v 1.105 2003/06/04 12:40:39 djm Exp $");
75 75
76#include "xmalloc.h" 76#include "xmalloc.h"
77#include "atomicio.h" 77#include "atomicio.h"
@@ -107,7 +107,16 @@ int showprogress = 1;
107char *ssh_program = _PATH_SSH_PROGRAM; 107char *ssh_program = _PATH_SSH_PROGRAM;
108 108
109/* This is used to store the pid of ssh_program */ 109/* This is used to store the pid of ssh_program */
110pid_t do_cmd_pid; 110pid_t do_cmd_pid = -1;
111
112static void
113killchild(int signo)
114{
115 if (do_cmd_pid > 1)
116 kill(do_cmd_pid, signo);
117
118 _exit(1);
119}
111 120
112/* 121/*
113 * This function executes the given command as the specified user on the 122 * 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)
170 *fdout = pin[1]; 179 *fdout = pin[1];
171 close(pout[1]); 180 close(pout[1]);
172 *fdin = pout[0]; 181 *fdin = pout[0];
182 signal(SIGTERM, killchild);
183 signal(SIGINT, killchild);
184 signal(SIGHUP, killchild);
173 return 0; 185 return 0;
174} 186}
175 187