diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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); | |||
272 | int | 272 | int |
273 | main(int argc, char **argv) | 273 | main(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)); |