diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2006-04-01 05:50:30 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2006-04-01 05:50:30 +0000 |
commit | 88469e360eabc8a7aaf0e58c00c93cff375844bb (patch) | |
tree | 321e0a1b240e9fca4b1a590cd0a731921012b796 | |
parent | c36fbfc783f2dac7d58db7663df22d3173161dd3 (diff) |
xasprintification; ok deraadt@
-rw-r--r-- | usr.bin/ssh/scp.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index 8216352679f..dd4d45f7cd8 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/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). @@ -413,7 +413,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)); @@ -479,9 +478,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) @@ -500,7 +497,6 @@ tolocal(int argc, char **argv) { char *bp, *host, *src, *suser; arglist alist; - size_t len; int i; memset(&alist, '\0', sizeof(alist)); @@ -533,9 +529,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; |