SETGID(3) Library Functions Manual SETGID(3)
NAME
setgid —
set-group-ID
SYNOPSIS
#include <sys/types.h> #include <unistd.h> int setgid(gid_t gid);
DESCRIPTION
If the process has appropriate privileges, setgid() sets the real group ID, effective group ID and the saved set-group-ID to gid .
If the process does not have appropriate privileges, but
gid is equal to the real group ID or the saved
set-group-ID, setgid () function sets the effective
group ID to gid; the real group ID and saved set-group-ID
remain unchanged.
Any supplementary group IDs of the calling process remain unchanged.
RETURN VALUE
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The setgid() function will fail if:
EXAMPLES
None.
APPLICATION USAGE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
exec(3) , getgid(3) , setuid(3) , <sys/types.h> , <unistd.h> .
DERIVATION
Derived from Issue 1 of the SVID.
February 1997 posix.fail