2 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
11 #include <sys/types.h>
12 #include <sys/syscall.h>
14 #if !defined __UCLIBC_LINUX_SPECIFIC__
16 #undef __NR_setresuid32
19 /* libc_hidden_proto(seteuid) */
21 #if (defined __NR_setresuid || defined __NR_setresuid32) && defined __USE_GNU
22 /* libc_hidden_proto(setresuid) */
24 /* libc_hidden_proto(setreuid) */
26 int seteuid(uid_t uid)
30 if (uid == (uid_t) ~0)
36 #if (defined __NR_setresuid || defined __NR_setresuid32) && defined __USE_GNU
37 result = setresuid(-1, uid, -1);
38 if (result == -1 && errno == ENOSYS)
39 /* Will also set the saved user ID if euid != uid,
40 * making it impossible to switch back...*/
42 result = setreuid(-1, uid);
46 libc_hidden_def(seteuid)