PXFSETGID (L*X, M*X)

POSIX Subroutine: Sets the effective group ID of the current process.

Module: USE IFPOSIX

Syntax

CALL PXFSETGID (igid, ierror)

igid
(Input) INTEGER(4). The group ID.


ierror
(Output) INTEGER(4). The error status.

If successful, ierror is set to zero; otherwise, an error code.

If the caller is the superuser, the real and saved group ID's are also set. This feature allows a program other than root to drop all of its group privileges, do some un-privileged work, and then re-engage the original effective group ID in a secure manner.

Caution

If the user is root then special care must be taken. PXFSETGID checks the effective gid of the caller. If it is the superuser, all process-related group ID's are set to gid. After this has occurred, it is impossible for the program to regain root privileges.

See Also

PXFGETGID