diff options
Diffstat (limited to 'scp.c')
-rw-r--r-- | scp.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: scp.c,v 1.158 2007/06/12 13:54:28 dtucker Exp $ */ | 1 | /* $OpenBSD: scp.c,v 1.159 2007/06/13 00:21:27 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). |
@@ -1024,7 +1024,8 @@ bad: run_err("%s: %s", np, strerror(errno)); | |||
1024 | wrerr = YES; | 1024 | wrerr = YES; |
1025 | wrerrno = errno; | 1025 | wrerrno = errno; |
1026 | } | 1026 | } |
1027 | if (wrerr == NO && ftruncate(ofd, size) != 0) { | 1027 | if (wrerr == NO && (!exists || S_ISREG(stb.st_mode)) && |
1028 | ftruncate(ofd, size) != 0) { | ||
1028 | run_err("%s: truncate: %s", np, strerror(errno)); | 1029 | run_err("%s: truncate: %s", np, strerror(errno)); |
1029 | wrerr = DISPLAYED; | 1030 | wrerr = DISPLAYED; |
1030 | } | 1031 | } |