|ISSETUGID(2)||System Calls Manual||ISSETUGID(2)|
issetugid — is
current executable running setuid or setgid
This system call exists so that library routines (inside libtermlib, libc, or other libraries) can guarantee safe behavior when used inside setuid or setgid programs. Some library routines may be passed insufficient information and hence not know whether the current program was started setuid or setgid because higher level calling code may have made changes to the uid, euid, gid, or egid. Hence these low-level library routines are unable to determine if they are being run with elevated or normal privileges.
In particular, it is wise to use this call to
determine if a pathname returned from a
call may safely be used to
the specified file. Quite often this is not wise because the status of the
effective uid is not known.
The status of
is only affected by
If a child process executes a new executable file, a new issetugid status
will be determined. This status is based on the existing process's uid,
euid, gid, and egid permissions and on the modes of the executable file. If
the new executable file modes are setuid or setgid, or if the existing
process is executing the new image with uid != euid or gid != egid, the new
process will be considered issetugid.
issetugid() function is always
successful, and no return value is reserved to indicate an error.
issetugid() function call first
appeared in OpenBSD 2.0.
|September 10, 2015||OpenBSD-6.8|