- 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@
This commit is contained in:
Damien Miller 2003-01-10 21:44:48 +11:00
parent a7f3aaadc3
commit 86b781c179
2 changed files with 8 additions and 3 deletions

View File

@ -17,6 +17,11 @@
[sftp-client.c]
Simplify and avoid redundancy in packet send and receive
functions; ok fgs@
- 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@
20030108
- (djm) Sync openbsd-compat/ with OpenBSD -current
@ -985,4 +990,4 @@
save auth method before monitor_reset_key_state(); bugzilla bug #284;
ok provos@
$Id: ChangeLog,v 1.2561 2003/01/10 10:43:58 djm Exp $
$Id: ChangeLog,v 1.2562 2003/01/10 10:44:48 djm Exp $

4
scp.c
View File

@ -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;
}