diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -71,7 +71,7 @@ | |||
71 | */ | 71 | */ |
72 | 72 | ||
73 | #include "includes.h" | 73 | #include "includes.h" |
74 | RCSID("$OpenBSD: scp.c,v 1.104 2003/06/04 12:18:49 djm Exp $"); | 74 | RCSID("$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; | |||
107 | char *ssh_program = _PATH_SSH_PROGRAM; | 107 | char *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 */ |
110 | pid_t do_cmd_pid; | 110 | pid_t do_cmd_pid = -1; |
111 | |||
112 | static void | ||
113 | killchild(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 | ||