musl/src/stat
Rich Felker 65ea604c74 fix failure of fchmod, fstat, fchdir, and fchown to produce EBADF
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-12-19 14:24:55 -05:00
..
__fxstat.c add LSB ABI __xstat, etc. junk 2012-05-31 23:32:09 -04:00
__fxstatat.c add LSB ABI __xstat, etc. junk 2012-05-31 23:32:09 -04:00
__lxstat.c add LSB ABI __xstat, etc. junk 2012-05-31 23:32:09 -04:00
__xstat.c add LSB ABI __xstat, etc. junk 2012-05-31 23:32:09 -04:00
chmod.c global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
fchmod.c fix failure of fchmod, fstat, fchdir, and fchown to produce EBADF 2013-12-19 14:24:55 -05:00
fchmodat.c include cleanups: remove unused headers and add feature test macros 2013-12-12 05:09:18 +00:00
fstat.c fix failure of fchmod, fstat, fchdir, and fchown to produce EBADF 2013-12-19 14:24:55 -05:00
fstatat.c use restrict everywhere it's required by c99 and/or posix 2008 2012-09-06 22:44:55 -04:00
futimens.c implement futimens and utimensat 2011-02-27 03:48:57 -05:00
futimesat.c include cleanups: remove unused headers and add feature test macros 2013-12-12 05:09:18 +00:00
lchmod.c include cleanups: remove unused headers and add feature test macros 2013-12-12 05:09:18 +00:00
lstat.c use restrict everywhere it's required by c99 and/or posix 2008 2012-09-06 22:44:55 -04:00
mkdir.c global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
mkdirat.c global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
mkfifo.c initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00
mkfifoat.c initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00
mknod.c fix mknod and mknodat to accept large dev_t values 2013-05-16 16:27:37 -04:00
mknodat.c fix mknod and mknodat to accept large dev_t values 2013-05-16 16:27:37 -04:00
stat.c use restrict everywhere it's required by c99 and/or posix 2008 2012-09-06 22:44:55 -04:00
statvfs.c improve [f]stat[v]fs functions, and possibly work around old kernels 2013-07-19 02:48:18 -04:00
umask.c global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00
utimensat.c global cleanup to use the new syscall interface 2011-03-20 00:16:43 -04:00