diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-11-29 20:17:10 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-11-29 20:17:10 +0000 |
commit | 9f259eecd663acffd38f62defdafc08d26653e2e (patch) | |
tree | 7db58fc505c31e5aff9d22d77ba51341bd250a4c /libexec/ftpd/ftpd.c | |
parent | 80061d33179f860f34cc9a9f82a11432a2a40fe1 (diff) |
When restarting a STOR, open with "r+", not "w" so we don't truncate.
Based on a patch from rmooney@iss.net; closed PR #993
Diffstat (limited to 'libexec/ftpd/ftpd.c')
-rw-r--r-- | libexec/ftpd/ftpd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index c3703e3e520..98bc1a7fd45 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.58 1999/11/14 22:25:02 deraadt Exp $ */ +/* $OpenBSD: ftpd.c,v 1.59 1999/11/29 20:17:09 millert Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -1022,6 +1022,9 @@ store(name, mode, unique) struct stat st; int fd; + if (restart_point && type != TYPE_A) + mode = "r+"; + if (unique && stat(name, &st) == 0) { char *nam; @@ -1031,8 +1034,6 @@ store(name, mode, unique) return; } name = nam; - if (restart_point) - mode = "r+"; fout = fdopen(fd, mode); } else fout = fopen(name, mode); |