ISSETUGID(2) BSD System Calls Manual ISSETUGID(2)NAMEissetugid — is current executable running setuid or setgid
SYNOPSIS
#include <unistd.h>
int
issetugid(void);
DESCRIPTION
The issetugid() function returns 1 if the process was made setuid or set‐
gid as the result of the last execve() system call. Otherwise it returns
0.
This system call exists so that library routines (inside libc,
libtermlib, or other libraries) can gaurantee safe behavior when used
inside setuid or setgid programs. Some library routines may not be
passed sufficient information to know if the current program was started
setuid or setgid because higher level calling code may have made changes
to the uid or the euid. In particular, it is wise to use this call to
determine if a pathname returned from a getenv() call may safely be used
to open() the specified file.
issetugid() is unaffected by calls to setuid(), fork(), and other such
calls. It is only controlled by execve().
ERRORS
The issetugid() function is always successful, and no return value is
reserved to indicate an error.
SEE ALSOexecve(2), setuid(2), seteuid(2,) setgid(2), setegid(2)HISTORY
A lstat() function call appeared in OpenBSD 2.0
OpenBSD 2.0 August, 25 1996 OpenBSD 2.0