diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: scp.c,v 1.170 2010/12/09 14:13:33 jmc Exp $ */ | 1 | /* $OpenBSD: scp.c,v 1.171 2011/09/09 22:37:01 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). |
@@ -609,12 +609,14 @@ toremote(char *targ, int argc, char **argv) | |||
609 | host = cleanhostname(argv[i]); | 609 | host = cleanhostname(argv[i]); |
610 | suser = NULL; | 610 | suser = NULL; |
611 | } | 611 | } |
612 | xasprintf(&bp, "%s -f -- %s", cmd, src); | 612 | xasprintf(&bp, "%s -f %s%s", cmd, |
613 | *src == '-' ? "-- " : "", src); | ||
613 | if (do_cmd(host, suser, bp, &remin, &remout) < 0) | 614 | if (do_cmd(host, suser, bp, &remin, &remout) < 0) |
614 | exit(1); | 615 | exit(1); |
615 | (void) xfree(bp); | 616 | (void) xfree(bp); |
616 | host = cleanhostname(thost); | 617 | host = cleanhostname(thost); |
617 | xasprintf(&bp, "%s -t -- %s", cmd, targ); | 618 | xasprintf(&bp, "%s -t %s%s", cmd, |
619 | *targ == '-' ? "-- " : "", targ); | ||
618 | if (do_cmd2(host, tuser, bp, remin, remout) < 0) | 620 | if (do_cmd2(host, tuser, bp, remin, remout) < 0) |
619 | exit(1); | 621 | exit(1); |
620 | (void) xfree(bp); | 622 | (void) xfree(bp); |
@@ -660,7 +662,8 @@ toremote(char *targ, int argc, char **argv) | |||
660 | errs = 1; | 662 | errs = 1; |
661 | } else { /* local to remote */ | 663 | } else { /* local to remote */ |
662 | if (remin == -1) { | 664 | if (remin == -1) { |
663 | xasprintf(&bp, "%s -t -- %s", cmd, targ); | 665 | xasprintf(&bp, "%s -t %s%s", cmd, |
666 | *targ == '-' ? "-- " : "", targ); | ||
664 | host = cleanhostname(thost); | 667 | host = cleanhostname(thost); |
665 | if (do_cmd(host, tuser, bp, &remin, | 668 | if (do_cmd(host, tuser, bp, &remin, |
666 | &remout) < 0) | 669 | &remout) < 0) |
@@ -713,7 +716,8 @@ tolocal(int argc, char **argv) | |||
713 | suser = pwd->pw_name; | 716 | suser = pwd->pw_name; |
714 | } | 717 | } |
715 | host = cleanhostname(host); | 718 | host = cleanhostname(host); |
716 | xasprintf(&bp, "%s -f -- %s", cmd, src); | 719 | xasprintf(&bp, "%s -f %s%s", |
720 | cmd, *src == '-' ? "-- " : "", src); | ||
717 | if (do_cmd(host, suser, bp, &remin, &remout) < 0) { | 721 | if (do_cmd(host, suser, bp, &remin, &remout) < 0) { |
718 | (void) xfree(bp); | 722 | (void) xfree(bp); |
719 | ++errs; | 723 | ++errs; |