summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/setgid.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/setgid.c')
-rw-r--r--libc/sysdeps/linux/common/setgid.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/setgid.c b/libc/sysdeps/linux/common/setgid.c
index d0698f517..45bcdb2e9 100644
--- a/libc/sysdeps/linux/common/setgid.c
+++ b/libc/sysdeps/linux/common/setgid.c
@@ -9,8 +9,19 @@
#include "syscalls.h"
#include <unistd.h>
+#include <bits/wordsize.h>
-#define __NR___syscall_setgid __NR_setgid
+#if (__WORDSIZE == 32 && defined(__NR_setgid32)) || __WORDSIZE == 64
+# ifdef __NR_setgid32
+# undef __NR_setgid
+# define __NR_setgid __NR_setgid32
+# endif
+
+_syscall1(int, setgid, gid_t, gid);
+
+#else
+
+# define __NR___syscall_setgid __NR_setgid
static inline _syscall1(int, __syscall_setgid, __kernel_gid_t, gid);
int setgid(gid_t gid)
@@ -21,3 +32,4 @@ int setgid(gid_t gid)
}
return (__syscall_setgid(gid));
}
+#endif