summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-16 21:23:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-16 21:23:50 +0000
commit56360a69f7a1a6fff3b8a467ec0c1bc4fbde99b9 (patch)
tree9ac2ccf7e8b0756184f99551c9f000d10cd189c3
parente8d93cc277d45f6bcaa78b265359776e2e10db01 (diff)
use O_CREAT in -C mode too, for in case it is not there the first time
from frantisek holop, ok millert
-rw-r--r--usr.bin/ftp/fetch.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c
index 4f716759b62..7ce978f8381 100644
--- a/usr.bin/ftp/fetch.c
+++ b/usr.bin/ftp/fetch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fetch.c,v 1.81 2008/09/26 11:11:59 espie Exp $ */
+/* $OpenBSD: fetch.c,v 1.82 2008/10/16 21:23:49 deraadt Exp $ */
/* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */
/*-
@@ -31,7 +31,7 @@
*/
#if !defined(lint) && !defined(SMALL)
-static const char rcsid[] = "$OpenBSD: fetch.c,v 1.81 2008/09/26 11:11:59 espie Exp $";
+static const char rcsid[] = "$OpenBSD: fetch.c,v 1.82 2008/10/16 21:23:49 deraadt Exp $";
#endif /* not lint and not SMALL */
/*
@@ -261,11 +261,13 @@ url_get(const char *origline, const char *proxyenv, const char *outfile)
else
filesize = st.st_size;
- /* Open the output file. */
+ /* Open the output file */
if (strcmp(savefile, "-") != 0) {
#ifndef SMALL
if (resume)
- out = open(savefile, O_APPEND | O_WRONLY);
+ out = open(savefile, O_CREAT | O_WRONLY |
+ O_APPEND, 0666);
+
else
#endif /* !SMALL */
out = open(savefile, O_CREAT | O_WRONLY |