]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
linux: Use long int for syscall return value
authorXing Li <lixing@loongson.cn>
Tue, 29 Nov 2022 11:24:43 +0000 (19:24 +0800)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 7 Dec 2022 13:37:06 +0000 (10:37 -0300)
The linux syscall ABI returns long, so the generic syscall code for
linux should use long for the return value.

This fixes the truncation of the return value of the syscall function
when that does not fit into an int.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
sysdeps/unix/sysv/linux/syscall.c

index 7303ba71888294de63aa158bf9e8da9f0213a64b..8cb0b66b1ca81411f28c2fbcb812742dda639c61 100644 (file)
@@ -33,7 +33,7 @@ syscall (long int number, ...)
   long int a5 = va_arg (args, long int);
   va_end (args);
 
-  int r = INTERNAL_SYSCALL_NCS_CALL (number, a0, a1, a2, a3, a4, a5);
+  long int r = INTERNAL_SYSCALL_NCS_CALL (number, a0, a1, a2, a3, a4, a5);
   if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (r)))
     {
       __set_errno (-r);