| OLD | NEW |
| 1 #include <stdio.h> | 1 #include <stdio.h> |
| 2 #include <errno.h> | 2 #include <errno.h> |
| 3 #include <fcntl.h> | 3 #include <fcntl.h> |
| 4 #include <unistd.h> |
| 4 #include "syscall.h" | 5 #include "syscall.h" |
| 5 | 6 |
| 6 int remove(const char* path) { | 7 int remove(const char* path) { |
| 7 #ifdef SYS_unlink | 8 int r = unlink(path); |
| 8 int r = __syscall(SYS_unlink, path); | |
| 9 #else | |
| 10 int r = __syscall(SYS_unlinkat, AT_FDCWD, path, 0); | |
| 11 #endif | |
| 12 #ifdef SYS_rmdir | 9 #ifdef SYS_rmdir |
| 13 if (r == -EISDIR) | 10 if (r == -EISDIR) |
| 14 r = __syscall(SYS_rmdir, path); | 11 r = __syscall(SYS_rmdir, path); |
| 15 #else | 12 #else |
| 16 if (r == -EISDIR) | 13 if (r == -EISDIR) |
| 17 r = __syscall(SYS_unlinkat, AT_FDCWD, path, AT_REMOVEDIR); | 14 r = __syscall(SYS_unlinkat, AT_FDCWD, path, AT_REMOVEDIR); |
| 18 #endif | 15 #endif |
| 19 return __syscall_ret(r); | 16 return __syscall_ret(r); |
| 20 } | 17 } |
| OLD | NEW |