diff options
author | Jiaxun Yang <jiaxun.yang@flygoat.com> | 2021-09-07 13:31:42 +0800 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-09-07 10:09:54 -0300 |
commit | 66016ec8aeefd40e016d7040d966484c764b0e9c (patch) | |
tree | 7657dabec84ffb5c4f5a400838d5343134b8a794 | |
parent | 4e04a47208e1712fcf202a6d9831f0900d575225 (diff) | |
download | glibc-66016ec8aeefd40e016d7040d966484c764b0e9c.tar.gz glibc-66016ec8aeefd40e016d7040d966484c764b0e9c.tar.xz glibc-66016ec8aeefd40e016d7040d966484c764b0e9c.zip |
MIPS: Setup errno for {f,l,}xstat
{f,l,}xstat stub for MIPS is using INTERNAL_SYSCALL to do xstat syscall for glibc ver, However it leaves errno untouched and thus giving bad errno output. Setup errno properly when syscall returns non-zero. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/fxstat.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/lxstat.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/xstat.c | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c index 11511d30b3..4a6016ff12 100644 --- a/sysdeps/unix/sysv/linux/mips/fxstat.c +++ b/sysdeps/unix/sysv/linux/mips/fxstat.c @@ -35,7 +35,9 @@ __fxstat (int vers, int fd, struct stat *buf) { struct kernel_stat kbuf; int r = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf); - return r ?: __xstat_conv (vers, &kbuf, buf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); } } } diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.c b/sysdeps/unix/sysv/linux/mips/lxstat.c index 871fb6c6c5..54f990a250 100644 --- a/sysdeps/unix/sysv/linux/mips/lxstat.c +++ b/sysdeps/unix/sysv/linux/mips/lxstat.c @@ -35,7 +35,9 @@ __lxstat (int vers, const char *name, struct stat *buf) { struct kernel_stat kbuf; int r = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf); - return r ?: __xstat_conv (vers, &kbuf, buf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); } } } diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c index 9d810b6f65..86f4dc31a8 100644 --- a/sysdeps/unix/sysv/linux/mips/xstat.c +++ b/sysdeps/unix/sysv/linux/mips/xstat.c @@ -35,7 +35,9 @@ __xstat (int vers, const char *name, struct stat *buf) { struct kernel_stat kbuf; int r = INTERNAL_SYSCALL_CALL (stat, name, &kbuf); - return r ?: __xstat_conv (vers, &kbuf, buf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); } } } |