diff options
author | des <des@FreeBSD.org> | 2000-08-31 11:24:15 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2000-08-31 11:24:15 +0000 |
commit | 23f9ab64bfdec4e9a1f5b04eb9b1e3e8d4022c17 (patch) | |
tree | 9a176cb12a1c6a604ed1903d0b4a774cc156acb2 /usr.bin | |
parent | 7f8b311e6aed4778d98c795a6667694494e8df47 (diff) | |
download | FreeBSD-src-23f9ab64bfdec4e9a1f5b04eb9b1e3e8d4022c17.zip FreeBSD-src-23f9ab64bfdec4e9a1f5b04eb9b1e3e8d4022c17.tar.gz |
Don't unlink the target file if it's not a regular file.
Diffstat (limited to 'usr.bin')
-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; |