diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-09-28 13:56:21 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-11-20 13:15:24 -0300 |
commit | 65341f7bbea824d2ff9d37db15d8be162df42bd3 (patch) | |
tree | ff89d7074d0602f93b0c872966c4bc288ac5d7d3 /io | |
parent | c52c2c32db15aba8bbe1a0b4d3235f97d9c1a525 (diff) | |
download | glibc-65341f7bbea824d2ff9d37db15d8be162df42bd3.tar glibc-65341f7bbea824d2ff9d37db15d8be162df42bd3.tar.gz glibc-65341f7bbea824d2ff9d37db15d8be162df42bd3.tar.bz2 glibc-65341f7bbea824d2ff9d37db15d8be162df42bd3.zip |
linux: Use fchmodat2 on fchmod for flags different than 0 (BZ 26401)
Linux 6.6 (09da082b07bbae1c) added support for fchmodat2, which has
similar semantics as fchmodat with an extra flag argument. This
allows fchmodat to implement AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH
without the need for procfs.
The syscall is registered on all architectures (with value of 452
except on alpha which is 562, commit 78252deb023cf087).
The tst-lchmod.c requires a small fix where fchmodat checks two
contradictory assertions ('(st.st_mode & 0777) == 2' and
'(st.st_mode & 0777) == 3').
Checked on x86_64-linux-gnu on a 6.6 kernel.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'io')
-rw-r--r-- | io/tst-lchmod.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/io/tst-lchmod.c b/io/tst-lchmod.c index 2bf4835b05..6496dc61e0 100644 --- a/io/tst-lchmod.c +++ b/io/tst-lchmod.c @@ -219,9 +219,9 @@ test_1 (bool do_relative_path, int (*chmod_func) (int fd, const char *, mode_t, /* The error code from the openat fallback leaks out. */ if (errno != ENFILE && errno != EMFILE) TEST_COMPARE (errno, EOPNOTSUPP); + xstat (path_file, &st); + TEST_COMPARE (st.st_mode & 0777, 3); } - xstat (path_file, &st); - TEST_COMPARE (st.st_mode & 0777, 3); /* Close the descriptors. */ for (int *pfd = fd_list_begin (&fd_list); pfd < fd_list_end (&fd_list); |