summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/scp.c b/scp.c
index 18b2597fe..08587b5f2 100644
--- a/scp.c
+++ b/scp.c
@@ -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).
@@ -601,12 +601,14 @@ toremote(char *targ, int argc, char **argv)
601 host = cleanhostname(argv[i]); 601 host = cleanhostname(argv[i]);
602 suser = NULL; 602 suser = NULL;
603 } 603 }
604 xasprintf(&bp, "%s -f -- %s", cmd, src); 604 xasprintf(&bp, "%s -f %s%s", cmd,
605 *src == '-' ? "-- " : "", src);
605 if (do_cmd(host, suser, bp, &remin, &remout) < 0) 606 if (do_cmd(host, suser, bp, &remin, &remout) < 0)
606 exit(1); 607 exit(1);
607 (void) xfree(bp); 608 (void) xfree(bp);
608 host = cleanhostname(thost); 609 host = cleanhostname(thost);
609 xasprintf(&bp, "%s -t -- %s", cmd, targ); 610 xasprintf(&bp, "%s -t %s%s", cmd,
611 *targ == '-' ? "-- " : "", targ);
610 if (do_cmd2(host, tuser, bp, remin, remout) < 0) 612 if (do_cmd2(host, tuser, bp, remin, remout) < 0)
611 exit(1); 613 exit(1);
612 (void) xfree(bp); 614 (void) xfree(bp);
@@ -652,7 +654,8 @@ toremote(char *targ, int argc, char **argv)
652 errs = 1; 654 errs = 1;
653 } else { /* local to remote */ 655 } else { /* local to remote */
654 if (remin == -1) { 656 if (remin == -1) {
655 xasprintf(&bp, "%s -t -- %s", cmd, targ); 657 xasprintf(&bp, "%s -t %s%s", cmd,
658 *targ == '-' ? "-- " : "", targ);
656 host = cleanhostname(thost); 659 host = cleanhostname(thost);
657 if (do_cmd(host, tuser, bp, &remin, 660 if (do_cmd(host, tuser, bp, &remin,
658 &remout) < 0) 661 &remout) < 0)
@@ -705,7 +708,8 @@ tolocal(int argc, char **argv)
705 suser = pwd->pw_name; 708 suser = pwd->pw_name;
706 } 709 }
707 host = cleanhostname(host); 710 host = cleanhostname(host);
708 xasprintf(&bp, "%s -f -- %s", cmd, src); 711 xasprintf(&bp, "%s -f %s%s",
712 cmd, *src == '-' ? "-- " : "", src);
709 if (do_cmd(host, suser, bp, &remin, &remout) < 0) { 713 if (do_cmd(host, suser, bp, &remin, &remout) < 0) {
710 (void) xfree(bp); 714 (void) xfree(bp);
711 ++errs; 715 ++errs;