diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2007-06-13 00:21:28 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2007-06-13 00:21:28 +0000 |
commit | b6beaff152c22af1b998cf05c5a1fa0c8d9f3e0b (patch) | |
tree | b8d105de73ff2b47fe96ce636f6004c2274eead9 /usr.bin/ssh/scp.c | |
parent | a855212f86b3f3ab67b833a2e91e74200ca5f995 (diff) |
don't ftruncate() non-regular files; bz#1236 reported by wood AT xmission.com;
ok dtucker@
Diffstat (limited to 'usr.bin/ssh/scp.c')
-rw-r--r-- | usr.bin/ssh/scp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index 619c43fe7de..e250272d879 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/scp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scp.c,v 1.158 2007/06/12 13:54:28 dtucker Exp $ */ +/* $OpenBSD: scp.c,v 1.159 2007/06/13 00:21:27 djm Exp $ */ /* * scp - secure remote copy. This is basically patched BSD rcp which * uses ssh to do the data transfer (instead of using rcmd). @@ -1009,7 +1009,8 @@ bad: run_err("%s: %s", np, strerror(errno)); wrerr = YES; wrerrno = errno; } - if (wrerr == NO && ftruncate(ofd, size) != 0) { + if (wrerr == NO && (!exists || S_ISREG(stb.st_mode)) && + ftruncate(ofd, size) != 0) { run_err("%s: truncate: %s", np, strerror(errno)); wrerr = DISPLAYED; } |