X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fremove.c;h=942e301a4c035f491c6b0ffef47b8e1572312678;hb=8949da7ab1c0dbf801e8bc78f0c0adc625020f75;hp=9e1de7f239f698aac83307c1034863fb902c1501;hpb=aa398f56fa398f2202b04e82c67f822f3233786f;p=musl diff --git a/src/stdio/remove.c b/src/stdio/remove.c index 9e1de7f2..942e301a 100644 --- a/src/stdio/remove.c +++ b/src/stdio/remove.c @@ -1,7 +1,19 @@ #include +#include +#include #include "syscall.h" int remove(const char *path) { - return syscall(SYS_unlink, path); +#ifdef SYS_unlink + int r = __syscall(SYS_unlink, path); +#else + int r = __syscall(SYS_unlinkat, AT_FDCWD, path, 0); +#endif +#ifdef SYS_rmdir + if (r==-EISDIR) r = __syscall(SYS_rmdir, path); +#else + if (r==-EISDIR) r = __syscall(SYS_unlinkat, AT_FDCWD, path, AT_REMOVEDIR); +#endif + return __syscall_ret(r); }