X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fremove.c;h=e147ba251440d8e04d8585604c8190891b1643ac;hb=6d861ac87491a207e4599c44b61d142f0a601c2d;hp=9e1de7f239f698aac83307c1034863fb902c1501;hpb=aa398f56fa398f2202b04e82c67f822f3233786f;p=musl diff --git a/src/stdio/remove.c b/src/stdio/remove.c index 9e1de7f2..e147ba25 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); + int r = syscall(SYS_unlink, path); + return (r && errno == EISDIR) ? syscall(SYS_rmdir, path) : r; }