summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-29 08:24:28 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-29 08:24:28 -0400
commit0b240ccf523b9af23dd1efa78274f397fcc90cdd (patch)
tree4ffebac3f63ebecf164955bd1fb6d46252f1a973
parent4106cdcd2de34bf3b9839e042344d92eae887ecb (diff)
downloadmusl-0b240ccf523b9af23dd1efa78274f397fcc90cdd.tar.gz
learned something new - remove is supposed to support directories on POSIX
-rw-r--r--src/stdio/remove.c4
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;
}