summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch/fetch.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/fetch/fetch.c')
-rw-r--r--usr.bin/fetch/fetch.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index d0e97ec..8d26671 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2000-2011 Dag-Erling Smørgrav
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -540,7 +540,7 @@ fetch(char *URL, const char *path)
goto failure;
}
/* we got it, open local file */
- if ((of = fopen(path, "a")) == NULL) {
+ if ((of = fopen(path, "r+")) == NULL) {
warn("%s: fopen()", path);
goto failure;
}
@@ -559,13 +559,13 @@ fetch(char *URL, const char *path)
sb = nsb;
/* picked up again later */
}
- /* seek to where we left off */
- if (of != NULL && fseek(of, url->offset, SEEK_SET) != 0) {
- warn("%s: fseek()", path);
- fclose(of);
- of = NULL;
- /* picked up again later */
- }
+ }
+ /* seek to where we left off */
+ if (of != NULL && fseeko(of, url->offset, SEEK_SET) != 0) {
+ warn("%s: fseeko()", path);
+ fclose(of);
+ of = NULL;
+ /* picked up again later */
}
} else if (m_flag && sb.st_size != -1) {
/* mirror mode, local file exists */
OpenPOWER on IntegriCloud