summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-01-10 21:44:48 +1100
committerDamien Miller <djm@mindrot.org>2003-01-10 21:44:48 +1100
commit86b781c179911d609bd0e3cfa3992f510cd56413 (patch)
tree1393ce990884738c92b908dda0b016332c5fa868 /scp.c
parenta7f3aaadc30b1533def73449081263a5d42d4aa4 (diff)
- 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 44b5b458..616dd378 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;
}