summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2006-04-23 12:04:46 +1000
committerDamien Miller <djm@mindrot.org>2006-04-23 12:04:46 +1000
commit7a656f792207bacd1148eb962919202908d83e9c (patch)
tree1dde5dfbd06b3210a0a972c7b389eaab4ec3ad84 /scp.c
parent07aa132a5e32f5c08694afabf5ebb14fb7c66006 (diff)
- djm@cvs.openbsd.org 2006/04/01 05:50:29
[scp.c] xasprintification; ok deraadt@
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/scp.c b/scp.c
index 6c8bbcdb7..2778f8f80 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.140 2006/04/01 05:42:20 deraadt Exp $ */ 1/* $OpenBSD: scp.c,v 1.141 2006/04/01 05:50:29 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).
@@ -422,7 +422,6 @@ toremote(char *targ, int argc, char **argv)
422{ 422{
423 char *bp, *host, *src, *suser, *thost, *tuser, *arg; 423 char *bp, *host, *src, *suser, *thost, *tuser, *arg;
424 arglist alist; 424 arglist alist;
425 size_t len;
426 int i; 425 int i;
427 426
428 memset(&alist, '\0', sizeof(alist)); 427 memset(&alist, '\0', sizeof(alist));
@@ -488,9 +487,7 @@ toremote(char *targ, int argc, char **argv)
488 errs = 1; 487 errs = 1;
489 } else { /* local to remote */ 488 } else { /* local to remote */
490 if (remin == -1) { 489 if (remin == -1) {
491 len = strlen(targ) + CMDNEEDS + 20; 490 xasprintf(&bp, "%s -t %s", cmd, targ);
492 bp = xmalloc(len);
493 (void) snprintf(bp, len, "%s -t %s", cmd, targ);
494 host = cleanhostname(thost); 491 host = cleanhostname(thost);
495 if (do_cmd(host, tuser, bp, &remin, 492 if (do_cmd(host, tuser, bp, &remin,
496 &remout) < 0) 493 &remout) < 0)
@@ -509,7 +506,6 @@ tolocal(int argc, char **argv)
509{ 506{
510 char *bp, *host, *src, *suser; 507 char *bp, *host, *src, *suser;
511 arglist alist; 508 arglist alist;
512 size_t len;
513 int i; 509 int i;
514 510
515 memset(&alist, '\0', sizeof(alist)); 511 memset(&alist, '\0', sizeof(alist));
@@ -542,9 +538,7 @@ tolocal(int argc, char **argv)
542 suser = pwd->pw_name; 538 suser = pwd->pw_name;
543 } 539 }
544 host = cleanhostname(host); 540 host = cleanhostname(host);
545 len = strlen(src) + CMDNEEDS + 20; 541 xasprintf(&bp, "%s -f %s", cmd, src);
546 bp = xmalloc(len);
547 (void) snprintf(bp, len, "%s -f %s", cmd, src);
548 if (do_cmd(host, suser, bp, &remin, &remout) < 0) { 542 if (do_cmd(host, suser, bp, &remin, &remout) < 0) {
549 (void) xfree(bp); 543 (void) xfree(bp);
550 ++errs; 544 ++errs;