X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fremove.c;h=942e301a4c035f491c6b0ffef47b8e1572312678;hb=95dfa3dd12108f42b23a1083e7b32266246a3590;hp=e147ba251440d8e04d8585604c8190891b1643ac;hpb=9646e4d024c05332c9653419abd6c41fdd48a33b;p=musl diff --git a/src/stdio/remove.c b/src/stdio/remove.c index e147ba25..942e301a 100644 --- a/src/stdio/remove.c +++ b/src/stdio/remove.c @@ -1,9 +1,19 @@ #include #include +#include #include "syscall.h" int remove(const char *path) { - int r = syscall(SYS_unlink, path); - return (r && errno == EISDIR) ? syscall(SYS_rmdir, path) : r; +#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); }