summaryrefslogtreecommitdiff
path: root/src/unistd/fchdir.c
AgeCommit message (Collapse)AuthorFilesLines
2013-12-19fix failure of fchmod, fstat, fchdir, and fchown to produce EBADFRich Felker1-1/+3
the workaround/fallback code for supporting O_PATH file descriptors when the kernel lacks support for performing these operations on them caused EBADF to get replaced by ENOENT (due to missing entry in /proc/self/fd). this is unlikely to affect real-world code (calls that might yield EBADF are generally unsafe, especially in library code) but it was breaking some test cases. the fix I've applied is something of a tradeoff: it adds one syscall to these operations on kernels where the workaround is needed. the alternative would be to catch ENOENT from the /proc lookup and translate it to EBADF, but I want to avoid doing that in the interest of not touching/depending on /proc at all in these functions as long as the kernel correctly supports the operations. this is following the general principle of isolating hacks to code paths that are taken on broken systems, and keeping the code for correct systems completely hack-free.
2013-08-02make fchdir, fchmod, fchown, and fstat support O_PATH file descriptorsRich Felker1-1/+9
on newer kernels, fchdir and fstat work anyway. this same fix should be applied to any other syscalls that are similarly affected. with this change, the current definitions of O_SEARCH and O_EXEC as O_PATH are mostly conforming to POSIX requirements. the main remaining issue is that O_NOFOLLOW has different semantics.
2011-03-20global cleanup to use the new syscall interfaceRich Felker1-1/+1
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker1-0/+7