mirror of
https://sourceware.org/git/glibc.git
synced 2025-10-12 19:04:54 +03:00
(setfsuid): Use INTERNAL_SYSCALL and do not check for errors (unless testing for 32bit variant).
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@@ -35,27 +35,28 @@ extern int __syscall_setfsuid32 (__kernel_uid32_t);
|
|||||||
# if __ASSUME_32BITUIDS == 0
|
# if __ASSUME_32BITUIDS == 0
|
||||||
/* This variable is shared with all files that need to check for 32bit
|
/* This variable is shared with all files that need to check for 32bit
|
||||||
uids. */
|
uids. */
|
||||||
extern int __libc_missing_32bit_uids;
|
extern int __libc_missing_32bit_uids attribute_hidden;
|
||||||
# endif
|
# endif
|
||||||
# endif /* __NR_setfsuid32 */
|
# endif /* __NR_setfsuid32 */
|
||||||
|
|
||||||
int
|
int
|
||||||
setfsuid (uid_t uid)
|
setfsuid (uid_t uid)
|
||||||
{
|
{
|
||||||
|
INTERNAL_SYSCALL_DECL (err);
|
||||||
# if __ASSUME_32BITUIDS > 0
|
# if __ASSUME_32BITUIDS > 0
|
||||||
return INLINE_SYSCALL (setfsuid32, 1, uid);
|
/* No error checking. */
|
||||||
# else
|
return INTERNAL_SYSCALL (setfsgid32, err, 1, gid);
|
||||||
|
# else
|
||||||
# ifdef __NR_setfsuid32
|
# ifdef __NR_setfsuid32
|
||||||
if (__libc_missing_32bit_uids <= 0)
|
if (__libc_missing_32bit_uids <= 0)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int saved_errno = errno;
|
|
||||||
|
|
||||||
result = INLINE_SYSCALL (setfsuid32, 1, uid);
|
result = INTERNAL_SYSCALL (setfsgid32, err, 1, gid);
|
||||||
if (result == 0 || errno != ENOSYS)
|
if (! INTERNAL_SYSCALL_ERROR_P (result, err)
|
||||||
|
|| INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
__set_errno (saved_errno);
|
|
||||||
__libc_missing_32bit_uids = 1;
|
__libc_missing_32bit_uids = 1;
|
||||||
}
|
}
|
||||||
# endif /* __NR_setfsuid32 */
|
# endif /* __NR_setfsuid32 */
|
||||||
@@ -66,7 +67,8 @@ setfsuid (uid_t uid)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return INLINE_SYSCALL (setfsuid, 1, uid);
|
/* No error checking. */
|
||||||
|
return INTERNAL_SYSCALL (setfsgid, err, 1, gid);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user