From: Rich Felker Date: Tue, 29 Mar 2011 12:24:28 +0000 (-0400) Subject: learned something new - remove is supposed to support directories on POSIX X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=0b240ccf523b9af23dd1efa78274f397fcc90cdd;ds=sidebyside learned something new - remove is supposed to support directories on POSIX --- 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 +#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; }