about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-10-14 14:31:38 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-10-16 14:17:44 -0300
commitcb49c65bb5581b5ca6122898716aad1f075982d8 (patch)
treecb7a33adffca63e59802ba2a8104f6155929d6f0 /sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h
parent9030377480effce89f382499ff47a22467112436 (diff)
downloadglibc-cb49c65bb5581b5ca6122898716aad1f075982d8.tar.gz
glibc-cb49c65bb5581b5ca6122898716aad1f075982d8.tar.xz
glibc-cb49c65bb5581b5ca6122898716aad1f075982d8.zip
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.
Diffstat (limited to 'sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h')
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h b/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h
index 1805d4b85f..71fe39fdd0 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h
+++ b/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h
@@ -19,13 +19,13 @@
 #include <sys/stat.h>
 #include <kernel_stat.h>
 
-static inline int
+static inline long int
 __cp_kstat_stat (const struct kernel_stat *kst, struct stat *st)
 {
   if (! in_ino_t_range (kst->st_ino)
       || ! in_off_t_range (kst->st_size)
       || ! in_blkcnt_t_range (kst->st_blocks))
-    return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW);
+    return -EOVERFLOW;
 
   st->st_dev = kst->st_dev;
   memset (&st->st_pad1, 0, sizeof (st->st_pad1));
@@ -51,7 +51,7 @@ __cp_kstat_stat (const struct kernel_stat *kst, struct stat *st)
   return 0;
 }
 
-static inline int
+static inline void
 __cp_kstat_stat64_t64 (const struct kernel_stat *kst, struct __stat64_t64 *st)
 {
   st->st_dev = kst->st_dev;
@@ -70,6 +70,4 @@ __cp_kstat_stat64_t64 (const struct kernel_stat *kst, struct __stat64_t64 *st)
   st->st_mtim.tv_nsec = kst->st_mtime_nsec;
   st->st_ctim.tv_sec = kst->st_ctime_sec;
   st->st_ctim.tv_nsec = kst->st_ctime_nsec;
-
-  return 0;
 }