[all-commits] [llvm/llvm-project] f17893: [libc] Fix chmod syscall arguments and add symlink...
Pavel Labath via All-commits
all-commits at lists.llvm.org
Fri Sep 25 01:36:56 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f17893d88ac11a34fc26dacd78f18bde2836334b
https://github.com/llvm/llvm-project/commit/f17893d88ac11a34fc26dacd78f18bde2836334b
Author: Pavel Labath <pavel at labath.sk>
Date: 2026-09-25 (Fri, 25 Sep 2026)
Changed paths:
M libc/src/__support/OSUtil/linux/syscall_wrappers/chmod.h
M libc/src/sys/stat/linux/CMakeLists.txt
M libc/test/src/sys/stat/CMakeLists.txt
M libc/test/src/sys/stat/chmod_test.cpp
Log Message:
-----------
[libc] Fix chmod syscall arguments and add symlink test (#226144)
Our Linux chmod wrapper had two bugs in how it invoked syscalls:
- the fchmodat syscall only takes three arguments (dfd, filename, mode),
but we were passing four (with a trailing 0 for flags).
- for fchmodat2, we were (mistakenly) passing AT_SYMLINK_NOFOLLOW, even
though chmod is specified to follow symlinks.
I reorder the checks to prefer fchmodat2 (with flags=0) if available,
and otherwise invoke fchmodat with the three arguments it expects.
I also add a test to verify that chmod follows symlinks and updates the
target file's permissions, and that attempting to chmod a dangling
symlink fails with ENOENT.
Assisted-by: Gemini
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list