Signed-off-by: Felix Fietkau <nbd@openwrt.org>
int ret;
if (create)
- flags |= O_CREAT;
+ flags |= O_CREAT | O_EXCL;
if (output_file) {
if (!strcmp(output_file, "-"))
if (!quiet)
fprintf(stderr, "Writing to stdout\n");
+ unlink(output_file);
return open(output_file, flags, 0644);
}
- /* Don't automatically overwrite files if the name is derived from the URL */
- if (create)
- flags |= O_EXCL;
-
filename = uclient_get_url_filename(path, "index.html");
if (!quiet)
fprintf(stderr, "Writing to '%s'\n", filename);