summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/scp.c b/scp.c
index 600df161a..6fe246d8c 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.144 2006/07/09 15:15:10 stevesk Exp $ */ 1/* $OpenBSD: scp.c,v 1.145 2006/07/10 12:03:20 djm 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).
@@ -272,15 +272,21 @@ void usage(void);
272int 272int
273main(int argc, char **argv) 273main(int argc, char **argv)
274{ 274{
275 int ch, fflag, tflag, status; 275 int ch, fflag, tflag, status, n;
276 double speed; 276 double speed;
277 char *targ, *endp; 277 char *targ, *endp, **newargv;
278 extern char *optarg; 278 extern char *optarg;
279 extern int optind; 279 extern int optind;
280 280
281 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ 281 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
282 sanitise_stdfd(); 282 sanitise_stdfd();
283 283
284 /* Copy argv, because we modify it */
285 newargv = xcalloc(MAX(argc + 1, 1), sizeof(*newargv));
286 for (n = 0; n < argc; n++)
287 newargv[n] = xstrdup(argv[n]);
288 argv = newargv;
289
284 __progname = ssh_get_progname(argv[0]); 290 __progname = ssh_get_progname(argv[0]);
285 291
286 memset(&args, '\0', sizeof(args)); 292 memset(&args, '\0', sizeof(args));