diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-03-29 08:24:28 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-03-29 08:24:28 -0400 |
commit | 0b240ccf523b9af23dd1efa78274f397fcc90cdd (patch) | |
tree | 4ffebac3f63ebecf164955bd1fb6d46252f1a973 | |
parent | 4106cdcd2de34bf3b9839e042344d92eae887ecb (diff) | |
download | musl-0b240ccf523b9af23dd1efa78274f397fcc90cdd.tar.gz musl-0b240ccf523b9af23dd1efa78274f397fcc90cdd.tar.xz musl-0b240ccf523b9af23dd1efa78274f397fcc90cdd.zip |
learned something new - remove is supposed to support directories on POSIX
-rw-r--r-- | src/stdio/remove.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stdio/remove.c b/src/stdio/remove.c index 9e1de7f2..fc12f7c1 100644 --- a/src/stdio/remove.c +++ b/src/stdio/remove.c @@ -1,7 +1,9 @@ #include <stdio.h> +#include <errno.h> #include "syscall.h" int remove(const char *path) { - return syscall(SYS_unlink, path); + return (syscall(SYS_unlink, path) && errno == EISDIR) + ? syscall(SYS_rmdir, path) : 0; } |