drop direct use of stat syscalls in fchmodat
authorRich Felker <dalias@aerifal.cx>
Thu, 28 Apr 2022 06:02:38 +0000 (02:02 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 2 May 2022 03:25:21 +0000 (23:25 -0400)
commit7edbcbeb76cb46381c34e2c0491dcc459cd5fa46
tree0d0ea2fd940b8cda26e17957ac8c0e8af243c560
parent9a9374955517bf731f11fd2c4a071b3cc1120526
drop direct use of stat syscalls in fchmodat

instead, use the fstatat/stat functions, so that the logic for which
syscalls are present and usable is all in fstatat.

this results in a slight increase in cost for old kernels on 32-bit
archs: now statx will be attempted first rather than just using the
legacy time32 syscalls, despite us not caring about timestamps.
however, it's not even clear that the legacy syscalls *should* succeed
if the timestamps are out of range; arguably they should fail with
EOVERFLOW. as such, paying a small cost here on old kernels seems
well-motivated.

with this change, fchmodat itself is no longer blocking ports to new
archs that lack the legacy syscalls.
src/stat/fchmodat.c