summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/scp.c b/scp.c
index f69fd05fc..1d34cc639 100644
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
71 */ 71 */
72 72
73#include "includes.h" 73#include "includes.h"
74RCSID("$OpenBSD: scp.c,v 1.119 2005/01/24 10:22:06 dtucker Exp $"); 74RCSID("$OpenBSD: scp.c,v 1.121 2005/04/02 12:41:16 djm Exp $");
75 75
76#include "xmalloc.h" 76#include "xmalloc.h"
77#include "atomicio.h" 77#include "atomicio.h"
@@ -361,20 +361,21 @@ void
361toremote(char *targ, int argc, char **argv) 361toremote(char *targ, int argc, char **argv)
362{ 362{
363 int i, len; 363 int i, len;
364 char *bp, *host, *src, *suser, *thost, *tuser; 364 char *bp, *host, *src, *suser, *thost, *tuser, *arg;
365 365
366 *targ++ = 0; 366 *targ++ = 0;
367 if (*targ == 0) 367 if (*targ == 0)
368 targ = "."; 368 targ = ".";
369 369
370 if ((thost = strrchr(argv[argc - 1], '@'))) { 370 arg = xstrdup(argv[argc - 1]);
371 if ((thost = strrchr(arg, '@'))) {
371 /* user@host */ 372 /* user@host */
372 *thost++ = 0; 373 *thost++ = 0;
373 tuser = argv[argc - 1]; 374 tuser = arg;
374 if (*tuser == '\0') 375 if (*tuser == '\0')
375 tuser = NULL; 376 tuser = NULL;
376 } else { 377 } else {
377 thost = argv[argc - 1]; 378 thost = arg;
378 tuser = NULL; 379 tuser = NULL;
379 } 380 }
380 381