summaryrefslogtreecommitdiffstats
path: root/scp.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-01-10 11:44:48 +0100
committerDamien Miller <djm@mindrot.org>2003-01-10 11:44:48 +0100
commit86b781c179911d609bd0e3cfa3992f510cd56413 (patch)
tree1393ce990884738c92b908dda0b016332c5fa868 /scp.c
parent - djm@cvs.openbsd.org 2003/01/10 08:48:15 (diff)
downloadopenssh-86b781c179911d609bd0e3cfa3992f510cd56413.tar.xz
openssh-86b781c179911d609bd0e3cfa3992f510cd56413.zip
- djm@cvs.openbsd.org 2003/01/10 10:29:35
[scp.c] Don't ftruncate after write error, creating sparse files of incorrect length mindrot bug #403, reported by rusr@cup.hp.com; ok markus@
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scp.c b/scp.c
index 44b5b4582..616dd3783 100644
--- a/scp.c
+++ b/scp.c
@@ -75,7 +75,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.97 2003/01/10 08:19:07 fgsch Exp $");
+RCSID("$OpenBSD: scp.c,v 1.98 2003/01/10 10:29:35 djm Exp $");
#include "xmalloc.h"
#include "atomicio.h"
@@ -864,7 +864,7 @@ bad: run_err("%s: %s", np, strerror(errno));
wrerr = YES;
wrerrno = j >= 0 ? EIO : errno;
}
- if (ftruncate(ofd, size)) {
+ if (wrerr == NO && ftruncate(ofd, size) != 0) {
run_err("%s: truncate: %s", np, strerror(errno));
wrerr = DISPLAYED;
}