]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
MIPS: Setup errno for {f,l,}xstat
authorJiaxun Yang <jiaxun.yang@flygoat.com>
Tue, 7 Sep 2021 05:31:42 +0000 (13:31 +0800)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 7 Sep 2021 13:09:54 +0000 (10:09 -0300)
{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>
sysdeps/unix/sysv/linux/mips/fxstat.c
sysdeps/unix/sysv/linux/mips/lxstat.c
sysdeps/unix/sysv/linux/mips/xstat.c

index 11511d30b38708ceabbc9b06abc2df55393961d7..4a6016ff123e8dd962dfbec926f595d40e9e2f9f 100644 (file)
@@ -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);
       }
     }
 }
index 871fb6c6c58866651a59617383e212d68dcf2258..54f990a250677091c2067d9118d57707c10d1342 100644 (file)
@@ -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);
       }
     }
 }
index 9d810b6f653b964bf91c8226942d10a48fe926bb..86f4dc31a82ff1bb27da22cf7a62e9ed3d5335a6 100644 (file)
@@ -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);
       }
     }
 }