blob: 3f9417fdd4b4c7c9fc62347980ca5f1b9c0c7220 [file] [log] [blame]
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include "syscall.h"
int remove(const char* path) {
int r = unlink(path);
#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);
}