summaryrefslogtreecommitdiff
path: root/uclient-fetch.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-21 16:58:26 +0100
committerFelix Fietkau <nbd@openwrt.org>2016-01-21 16:58:26 +0100
commitb9808a8c3a8922ed8df4e6fe45848ac2e52f13be (patch)
tree370405c0d797570f590f1fe00db97c5888750a85 /uclient-fetch.c
parent235ce84d97cb07a285aeee464ab3f24584cf394e (diff)
downloaduclient-b9808a8c3a8922ed8df4e6fe45848ac2e52f13be.tar.gz
uclient-fetch: allow overwriting files if -O was used
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'uclient-fetch.c')
-rw-r--r--uclient-fetch.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/uclient-fetch.c b/uclient-fetch.c
index 010117d..223d364 100644
--- a/uclient-fetch.c
+++ b/uclient-fetch.c
@@ -103,7 +103,10 @@ static int open_output_file(const char *path, uint64_t resume_offset)
if (cur_resume)
flags = O_RDWR;
else
- flags = O_WRONLY | O_EXCL;
+ flags = O_WRONLY;
+
+ if (!cur_resume && !output_file)
+ flags |= O_EXCL;
flags |= O_CREAT;