summaryrefslogtreecommitdiff
path: root/src/stat/fchmodat.c
AgeCommit message (Collapse)AuthorLines
2015-03-30fix failure of fchmodat to report EOPNOTSUPP in the race pathRich Felker-2/+5
in the case where a non-symlink file was replaced by a symlink during the fchmodat operation with AT_SYMLINK_NOFOLLOW, mode change on the new symlink target was successfully suppressed, but the error was not reported. instead, fchmodat simply returned 0. (cherry picked from commit 61b1d102129990f6e903c6ddcf46c7d79d1a1e99) (conflicts from commit dd5f50da6f6c3df5647e922e47f8568a8896a752)
2015-03-30fix fd leak race (missing O_CLOEXEC) in fchmodatRich Felker-1/+1
(cherry picked from commit 2736eb6caa70bb6e909d7d8ebbe145c2071435e0)
2013-12-12include cleanups: remove unused headers and add feature test macrosSzabolcs Nagy-1/+0
2013-08-02debloat code that depends on /proc/self/fd/%d with shared functionRich Felker-1/+3
I intend to add more Linux workarounds that depend on using these pathnames, and some of them will be in "syscall" functions that, from an anti-bloat standpoint, should not depend on the whole snprintf framework.
2013-08-02work around linux's lack of flags argument to fchmodat syscallRich Felker-1/+29
previously, the AT_SYMLINK_NOFOLLOW flag was ignored, giving dangerously incorrect behavior -- the target of the symlink had its modes changed to the modes (usually 0777) intended for the symlink). this issue was amplified by the fact that musl provides lchmod, as a wrapper for fchmodat, which some archival programs take as a sign that symlink modes are supported and thus attempt to use. emulating AT_SYMLINK_NOFOLLOW was a difficult problem, and I originally believed it could not be solved, at least not without depending on kernels newer than 3.5.x or so where O_PATH works halfway well. however, it turns out that accessing O_PATH file descriptors via their pseudo-symlink entries in /proc/self/fd works much better than trying to use the fd directly, and works even on older kernels. moreover, the kernel has permanently pegged these references to the inode obtained by the O_PATH open, so there should not be race conditions with the file being moved, deleted, replaced, etc.
2011-03-20global cleanup to use the new syscall interfaceRich Felker-1/+1
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker-0/+7