diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: scp.c,v 1.206 2019/09/09 02:31:19 dtucker Exp $ */ | 1 | /* $OpenBSD: scp.c,v 1.207 2020/01/23 07:10:22 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * scp - secure remote copy. This is basically patched BSD rcp which | 3 | * scp - secure remote copy. This is basically patched BSD rcp which |
4 | * uses ssh to do the data transfer (instead of using rcmd). | 4 | * uses ssh to do the data transfer (instead of using rcmd). |
@@ -94,7 +94,9 @@ | |||
94 | #include <dirent.h> | 94 | #include <dirent.h> |
95 | #include <errno.h> | 95 | #include <errno.h> |
96 | #include <fcntl.h> | 96 | #include <fcntl.h> |
97 | #ifdef HAVE_FNMATCH_H | ||
97 | #include <fnmatch.h> | 98 | #include <fnmatch.h> |
99 | #endif | ||
98 | #include <limits.h> | 100 | #include <limits.h> |
99 | #include <locale.h> | 101 | #include <locale.h> |
100 | #include <pwd.h> | 102 | #include <pwd.h> |
@@ -213,9 +215,9 @@ do_local_cmd(arglist *a) | |||
213 | } | 215 | } |
214 | 216 | ||
215 | do_cmd_pid = pid; | 217 | do_cmd_pid = pid; |
216 | signal(SIGTERM, killchild); | 218 | ssh_signal(SIGTERM, killchild); |
217 | signal(SIGINT, killchild); | 219 | ssh_signal(SIGINT, killchild); |
218 | signal(SIGHUP, killchild); | 220 | ssh_signal(SIGHUP, killchild); |
219 | 221 | ||
220 | while (waitpid(pid, &status, 0) == -1) | 222 | while (waitpid(pid, &status, 0) == -1) |
221 | if (errno != EINTR) | 223 | if (errno != EINTR) |
@@ -266,9 +268,9 @@ do_cmd(char *host, char *remuser, int port, char *cmd, int *fdin, int *fdout) | |||
266 | close(reserved[0]); | 268 | close(reserved[0]); |
267 | close(reserved[1]); | 269 | close(reserved[1]); |
268 | 270 | ||
269 | signal(SIGTSTP, suspchild); | 271 | ssh_signal(SIGTSTP, suspchild); |
270 | signal(SIGTTIN, suspchild); | 272 | ssh_signal(SIGTTIN, suspchild); |
271 | signal(SIGTTOU, suspchild); | 273 | ssh_signal(SIGTTOU, suspchild); |
272 | 274 | ||
273 | /* Fork a child to execute the command on the remote host using ssh. */ | 275 | /* Fork a child to execute the command on the remote host using ssh. */ |
274 | do_cmd_pid = fork(); | 276 | do_cmd_pid = fork(); |
@@ -305,9 +307,9 @@ do_cmd(char *host, char *remuser, int port, char *cmd, int *fdin, int *fdout) | |||
305 | *fdout = pin[1]; | 307 | *fdout = pin[1]; |
306 | close(pout[1]); | 308 | close(pout[1]); |
307 | *fdin = pout[0]; | 309 | *fdin = pout[0]; |
308 | signal(SIGTERM, killchild); | 310 | ssh_signal(SIGTERM, killchild); |
309 | signal(SIGINT, killchild); | 311 | ssh_signal(SIGINT, killchild); |
310 | signal(SIGHUP, killchild); | 312 | ssh_signal(SIGHUP, killchild); |
311 | return 0; | 313 | return 0; |
312 | } | 314 | } |
313 | 315 | ||
@@ -559,7 +561,7 @@ main(int argc, char **argv) | |||
559 | iamrecursive ? " -r" : "", pflag ? " -p" : "", | 561 | iamrecursive ? " -r" : "", pflag ? " -p" : "", |
560 | targetshouldbedirectory ? " -d" : ""); | 562 | targetshouldbedirectory ? " -d" : ""); |
561 | 563 | ||
562 | (void) signal(SIGPIPE, lostconn); | 564 | (void) ssh_signal(SIGPIPE, lostconn); |
563 | 565 | ||
564 | if (colon(argv[argc - 1])) /* Dest is remote host. */ | 566 | if (colon(argv[argc - 1])) /* Dest is remote host. */ |
565 | toremote(argc, argv); | 567 | toremote(argc, argv); |