uclient-fetch: allow overwriting files if -O was used
authorFelix Fietkau <nbd@openwrt.org>
Thu, 21 Jan 2016 15:58:26 +0000 (16:58 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 21 Jan 2016 15:58:26 +0000 (16:58 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
uclient-fetch.c

index 010117d4909fd79df81ac4f943f348e983e040ca..223d3641683b5519f7db5305597db05148543494 100644 (file)
@@ -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;