diff options
-rw-r--r-- | usr.bin/fetch/fetch.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c index ad605bf..d72814b 100644 --- a/usr.bin/fetch/fetch.c +++ b/usr.bin/fetch/fetch.c @@ -427,7 +427,8 @@ fetch(char *URL, char *path) goto done; failure: if (of && of != stdout && !R_flag && !r_flag) - unlink(path); + if (stat(path, &sb) != -1 && (sb.st_mode & S_IFREG)) + unlink(path); failure_keep: r = -1; goto done; |