summaryrefslogtreecommitdiffstats
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 6c8bbcdb..2778f8f8 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.140 2006/04/01 05:42:20 deraadt Exp $ */
+/* $OpenBSD: scp.c,v 1.141 2006/04/01 05:50:29 djm Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@@ -422,7 +422,6 @@ toremote(char *targ, int argc, char **argv)
{
char *bp, *host, *src, *suser, *thost, *tuser, *arg;
arglist alist;
- size_t len;
int i;
memset(&alist, '\0', sizeof(alist));
@@ -488,9 +487,7 @@ toremote(char *targ, int argc, char **argv)
errs = 1;
} else { /* local to remote */
if (remin == -1) {
- len = strlen(targ) + CMDNEEDS + 20;
- bp = xmalloc(len);
- (void) snprintf(bp, len, "%s -t %s", cmd, targ);
+ xasprintf(&bp, "%s -t %s", cmd, targ);
host = cleanhostname(thost);
if (do_cmd(host, tuser, bp, &remin,
&remout) < 0)
@@ -509,7 +506,6 @@ tolocal(int argc, char **argv)
{
char *bp, *host, *src, *suser;
arglist alist;
- size_t len;
int i;
memset(&alist, '\0', sizeof(alist));
@@ -542,9 +538,7 @@ tolocal(int argc, char **argv)
suser = pwd->pw_name;
}
host = cleanhostname(host);
- len = strlen(src) + CMDNEEDS + 20;
- bp = xmalloc(len);
- (void) snprintf(bp, len, "%s -f %s", cmd, src);
+ xasprintf(&bp, "%s -f %s", cmd, src);
if (do_cmd(host, suser, bp, &remin, &remout) < 0) {
(void) xfree(bp);
++errs;