summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}