diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386/setresgid.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/setresgid.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c index ab2738582b..45dbcc8485 100644 --- a/sysdeps/unix/sysv/linux/i386/setresgid.c +++ b/sysdeps/unix/sysv/linux/i386/setresgid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,14 +24,44 @@ #include <sysdep.h> #include <sys/syscall.h> +#include "kernel-features.h" + #ifdef __NR_setresgid extern int __syscall_setresgid (__kernel_gid_t rgid, __kernel_gid_t egid, __kernel_gid_t sgid); +# ifdef __NR_setresgid32 +extern int __syscall_setresgid32 (__kernel_gid32_t rgid, __kernel_gid32_t egid, + __kernel_gid32_t sgid); +# if __ASSUME_32BITUIDS == 0 +/* This variable is shared with all files that need to check for 32bit + uids. */ +extern int __libc_missing_32bit_uids; +# endif +# endif /* __NR_setresgid32 */ + int setresgid (gid_t rgid, gid_t egid, gid_t sgid) { +# if __ASSUME_32BITUIDS > 0 + return INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid); +# else +# ifdef __NR_setresgid32 + if (!__libc_missing_32bit_uids) + { + int result; + int saved_errno = errno; + + result = INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid); + if (result == 0 || errno != ENOSYS) + return result; + + __set_errno (saved_errno); + __libc_missing_32bit_uids = 1; + } +# endif /* __NR_setresgid32 */ + 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)) @@ -41,5 +71,6 @@ setresgid (gid_t rgid, gid_t egid, gid_t sgid) } return INLINE_SYSCALL (setresgid, 3, rgid, egid, sgid); +# endif } #endif |