diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 2000-09-20 04:43:13 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 2000-09-20 04:43:13 +0000 |
| commit | 6c05034cbe3599f937d2eb692f2bb7358e745052 (patch) | |
| tree | 8cb1c355b25faf8d862dd80b287817641206f347 /lib/libc/stdio/remove.c | |
| parent | ace4f3086617e9b6efcfb61e97491ec16cfbb8cd (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio/remove.c')
| -rw-r--r-- | lib/libc/stdio/remove.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc/stdio/remove.c b/lib/libc/stdio/remove.c index cca7cb627163..3518b68c7475 100644 --- a/lib/libc/stdio/remove.c +++ b/lib/libc/stdio/remove.c @@ -42,6 +42,8 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* LIBC_SCCS and not lint */ +#include <sys/types.h> +#include <sys/stat.h> #include <unistd.h> #include <stdio.h> @@ -49,5 +51,11 @@ int remove(file) const char *file; { + struct stat sb; + + if (lstat(file, &sb) < 0) + return (-1); + if (S_ISDIR(sb.st_mode)) + return (rmdir(file)); return (unlink(file)); } |
