From cb49c65bb5581b5ca6122898716aad1f075982d8 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 14 Oct 2020 14:31:38 -0300 Subject: linux: Use INTERNAL_SYSCALL on fstatat{64} Although not required by the standards, some code expects that a successful stat call should not set errno. However since aa03f722f3b99 'linux: Add {f}stat{at} y2038 support', on 32-bit systems with 32-bit time_t supporrt, stat implementation will first issues __NR_statx and if it fails with ENOSYS issue the system stat syscall. On architecture running on kernel without __NR_statx support the first call will set the errno to ENOSYS, even when the following stat syscall might not fail. This patch fixes by using INTERNAL_SYSCALL and only setting the errno value when function returns. Checked on i686-linux-gnu, x86_64-linux-gnu, sparc64-linux-gnu, sparcv9-linux-gnu, powerpc64-linux-gnu, powerpc64le-linux-gnu, arm-linux-gnueabihf, and aarch64-linux-gnu. --- sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sysdeps/unix/sysv/linux/sparc') diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h index 0599b6a49e..d3f2841ade 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h @@ -18,7 +18,7 @@ #include -static inline int +static inline void __cp_stat64_kstat64 (struct stat64 *st64, const struct kernel_stat64 *kst64) { st64->st_dev = kst64->st_dev; @@ -41,6 +41,4 @@ __cp_stat64_kstat64 (struct stat64 *st64, const struct kernel_stat64 *kst64) st64->st_ctim.tv_nsec = kst64->st_ctime_nsec; st64->__glibc_reserved4 = 0; st64->__glibc_reserved5 = 0; - - return 0; } -- cgit v1.2.3-70-g09d2