diff --git a/src/stdio/remove.c b/src/stdio/remove.c index 9e1de7f239f698aac83307c1034863fb902c1501..fc12f7c10578d2f2f05bb2e7a6753dbe626e2ed7 100644 --- a/src/stdio/remove.c +++ b/src/stdio/remove.c @@ -1,7 +1,9 @@ #include +#include #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; }