diff options
| author | Mikhail R. Gadelha <mikhail@igalia.com> | 2025-05-05 18:49:33 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-05 18:49:33 -0300 |
| commit | 230f332cf0139fed88145c9d2dd410c36348f2e4 (patch) | |
| tree | d53a0e4bb3223bc99226d301ad6b7158dc6c3178 /libc/src/sys | |
| parent | dfcb8cb2a92c9f72ddde5ea08dadf2f640197d32 (diff) | |
[libc] Swap order of syscall on chmod (#138427)
We define SYS_fchmodat2 on libc but the syscall is not available on old
kernels, so prefer the SYS_fchmodat version when possible.
Diffstat (limited to 'libc/src/sys')
| -rw-r--r-- | libc/src/sys/stat/linux/chmod.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libc/src/sys/stat/linux/chmod.cpp b/libc/src/sys/stat/linux/chmod.cpp index 57d5bae6b819..1b787e47e7c6 100644 --- a/libc/src/sys/stat/linux/chmod.cpp +++ b/libc/src/sys/stat/linux/chmod.cpp @@ -23,12 +23,12 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, chmod, (const char *path, mode_t mode)) { #ifdef SYS_chmod int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_chmod, path, mode); -#elif defined(SYS_fchmodat2) - int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat2, AT_FDCWD, path, - mode, 0, AT_SYMLINK_NOFOLLOW); #elif defined(SYS_fchmodat) int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat, AT_FDCWD, path, mode, 0); +#elif defined(SYS_fchmodat2) + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat2, AT_FDCWD, path, + mode, 0, AT_SYMLINK_NOFOLLOW); #else #error "chmod, fchmodat and fchmodat2 syscalls not available." #endif |
