setreuid(3) (BSD Compatibility Package) setreuid(3)
NAME
setreuid - set real and effective user IDs
SYNOPSIS
cc [ flag... ] file ... -lucb
int setreuid(ruid, euid)
int ruid, euid;
DESCRIPTION
setreuid is used to set the real and effective user IDs of the
calling process. setreuid is implemented via the system calls setuid
and seteuid. If ruid is not -1, then ruid is passed to setuid; if
euid is not -1, then euid is passed to seteuid.
The call to seteuid is attempted first.
See the setuid manual page for the description of the setuid and
seteuid system calls.
NOTE
This library call is slightly different from the original Berkeley
system call. You cannot set the real uid ID without resetting the
effective and saved uid IDs.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
ERRORS
setreuid will fail and neither of the user IDs will be changed if:
EPERM The calling process's effective user ID is not the
super-user and a change other than changing the real
user ID to the effective user ID, or changing the
effective user ID to the real user ID or the saved
set-user ID, was specified.
SEE ALSO
setregid(3)
exec(2), getuid(2), setuid(2) in the Programmer's Reference Manual.
10/91 Page 1