summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/scp.c b/scp.c
index 5a7a92a7e..9b64aa5f4 100644
--- a/scp.c
+++ b/scp.c
@@ -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>
@@ -221,9 +223,9 @@ do_local_cmd(arglist *a)
221 } 223 }
222 224
223 do_cmd_pid = pid; 225 do_cmd_pid = pid;
224 signal(SIGTERM, killchild); 226 ssh_signal(SIGTERM, killchild);
225 signal(SIGINT, killchild); 227 ssh_signal(SIGINT, killchild);
226 signal(SIGHUP, killchild); 228 ssh_signal(SIGHUP, killchild);
227 229
228 while (waitpid(pid, &status, 0) == -1) 230 while (waitpid(pid, &status, 0) == -1)
229 if (errno != EINTR) 231 if (errno != EINTR)
@@ -274,9 +276,9 @@ do_cmd(char *host, char *remuser, int port, char *cmd, int *fdin, int *fdout)
274 close(reserved[0]); 276 close(reserved[0]);
275 close(reserved[1]); 277 close(reserved[1]);
276 278
277 signal(SIGTSTP, suspchild); 279 ssh_signal(SIGTSTP, suspchild);
278 signal(SIGTTIN, suspchild); 280 ssh_signal(SIGTTIN, suspchild);
279 signal(SIGTTOU, suspchild); 281 ssh_signal(SIGTTOU, suspchild);
280 282
281 /* Fork a child to execute the command on the remote host using ssh. */ 283 /* Fork a child to execute the command on the remote host using ssh. */
282 do_cmd_pid = fork(); 284 do_cmd_pid = fork();
@@ -313,9 +315,9 @@ do_cmd(char *host, char *remuser, int port, char *cmd, int *fdin, int *fdout)
313 *fdout = pin[1]; 315 *fdout = pin[1];
314 close(pout[1]); 316 close(pout[1]);
315 *fdin = pout[0]; 317 *fdin = pout[0];
316 signal(SIGTERM, killchild); 318 ssh_signal(SIGTERM, killchild);
317 signal(SIGINT, killchild); 319 ssh_signal(SIGINT, killchild);
318 signal(SIGHUP, killchild); 320 ssh_signal(SIGHUP, killchild);
319 return 0; 321 return 0;
320} 322}
321 323
@@ -567,7 +569,7 @@ main(int argc, char **argv)
567 iamrecursive ? " -r" : "", pflag ? " -p" : "", 569 iamrecursive ? " -r" : "", pflag ? " -p" : "",
568 targetshouldbedirectory ? " -d" : ""); 570 targetshouldbedirectory ? " -d" : "");
569 571
570 (void) signal(SIGPIPE, lostconn); 572 (void) ssh_signal(SIGPIPE, lostconn);
571 573
572 if (colon(argv[argc - 1])) /* Dest is remote host. */ 574 if (colon(argv[argc - 1])) /* Dest is remote host. */
573 toremote(argc, argv); 575 toremote(argc, argv);