summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2000-06-29 08:39:29 +0000
committerdes <des@FreeBSD.org>2000-06-29 08:39:29 +0000
commit9a9fe3065a228d9c8201ebae1489dd866b19bb8b (patch)
tree4d603cd2be54f0ced32e10cc53d29ab8752880e4 /usr.bin/fetch
parent41961243a47d31214b55759c57b2d56af034606a (diff)
downloadFreeBSD-src-9a9fe3065a228d9c8201ebae1489dd866b19bb8b.zip
FreeBSD-src-9a9fe3065a228d9c8201ebae1489dd866b19bb8b.tar.gz
Don't forget to delete the output file if the request fails.
Don't delete the output file if -r was specified.
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r--usr.bin/fetch/fetch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index d063100..48d3da1 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -293,6 +293,8 @@ fetch(char *URL, char *path)
/* start the transfer */
if ((f = fetchGet(url, flags)) == NULL) {
warnx("%s", fetchLastErrString);
+ if (!R_flag && !r_flag && !o_stdout)
+ unlink(path);
goto failure;
}
@@ -358,7 +360,7 @@ fetch(char *URL, char *path)
if (ferror(of))
warn("%s", path);
if (ferror(f) || ferror(of)) {
- if (!R_flag && !o_stdout)
+ if (!R_flag && !r_flag && !o_stdout)
unlink(path);
goto failure;
}
OpenPOWER on IntegriCloud