about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/i386/setresgid.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/setresgid.c')
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresgid.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c
index 20256e1ebd..ab2738582b 100644
--- a/sysdeps/unix/sysv/linux/i386/setresgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresgid.c
@@ -22,6 +22,7 @@
 
 #include <linux/posix_types.h>
 
+#include <sysdep.h>
 #include <sys/syscall.h>
 #ifdef __NR_setresgid
 
@@ -31,14 +32,14 @@ extern int __syscall_setresgid (__kernel_gid_t rgid, __kernel_gid_t egid,
 int
 setresgid (gid_t rgid, gid_t egid, gid_t sgid)
 {
-  if ((rgid != (gid_t) ((__kernel_gid_t) rgid))
-      || (egid != (gid_t) ((__kernel_gid_t) egid))
-      || (sgid != (gid_t) ((__kernel_gid_t) sgid)))
+  if ((rgid != (gid_t) -1 && rgid != (gid_t) (__kernel_gid_t) rgid)
+      || (egid != (gid_t) -1 && egid != (gid_t) (__kernel_gid_t) egid)
+      || (sgid != (gid_t) -1 && sgid != (gid_t) (__kernel_gid_t) sgid))
     {
       __set_errno (EINVAL);
       return -1;
     }
 
-  return __syscall_setresgid (rgid, egid, sgid);
+  return INLINE_SYSCALL (setresgid, 3, rgid, egid, sgid);
 }
 #endif