Don't forget to delete the output file if the request fails.

Don't delete the output file if -r was specified.
This commit is contained in:
Dag-Erling Smørgrav 2000-06-29 08:39:29 +00:00
parent 0b74850760
commit df6f33d182
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=62245

View File

@ -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;
}