aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-01-02 11:31:52 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-01-12 15:11:11 -0300
commit061eaf024470627d835d347860d5f8c59b454d08 (patch)
tree32335675c27e857fdf39925cc0070923e1bdf40b /sysdeps
parent08ddd26814310e7c1b8c3956a6a0ac7aedea9cfd (diff)
downloadglibc-061eaf024470627d835d347860d5f8c59b454d08.zip
glibc-061eaf024470627d835d347860d5f8c59b454d08.tar.gz
glibc-061eaf024470627d835d347860d5f8c59b454d08.tar.bz2
linux: Fix fstat64 on alpha and sparc64
The 551101e8240b7514fc646d1722f8b79c90362b8f change is incorrect for alpha and sparc, since __NR_stat is defined by both kABI. Use __NR_newfstat to check whether to fallback to __NR_fstat64 (similar to what fstatat64 does). Checked on sparc64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/fstat64.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/fstat64.c b/sysdeps/unix/sysv/linux/fstat64.c
index f631ab2..cc9f695 100644
--- a/sysdeps/unix/sysv/linux/fstat64.c
+++ b/sysdeps/unix/sysv/linux/fstat64.c
@@ -30,8 +30,11 @@ __fstat64_time64 (int fd, struct __stat64_t64 *buf)
{
#if !FSTATAT_USE_STATX
# if XSTAT_IS_XSTAT64
-# ifdef __NR_fstat
- /* 64-bit kABI, e.g. aarch64, powerpc64*, s390x, riscv64, and
+ /* The __NR_stat macro is defined for all ABIs that also define
+ XSTAT_IS_STAT64, so to correctly identify alpha and sparc check
+ __NR_newfstatat (similar to what fstatat64 does). */
+# ifdef __NR_newfstatat
+ /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and
x86_64. */
return INLINE_SYSCALL_CALL (fstat, fd, buf);
# elif defined __NR_fstat64