mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 17:28:48 +00:00
For setreuid and setresuid syscalls, -1 means to set the current uid/euid/gid/egid value, to be more convenient for programming. However, for other syscalls where we pass only one argument, there's no justification to specify -1. This behavior is identical to how Linux handles the value -1, and is influenced by the fact that the manual pages for the group of one argument syscalls that handle ID operations is ambiguous about this topic.
988 B
988 B
Name
seteuid, setegid - set effective user / group ID
Synopsis
#include <unistd.h>
int seteuid(uid_t);
int setegid(gid_t);
Description
Sets the effective user or group ID.
For non-superusers, the effective ID can only be set to the current real or saved ID.
In particular, seteuid(geteuid())
will fail if the current effective user ID is not equal to the current real or saved ID.
Return value
If the call was set successful, returns 0.
Otherwise, returns -1 and sets errno
to describe the error.
Errors
EPERM
: The new ID is not equal to the real ID or saved ID, and the user is not superuser.EINVAL
: The new ID is set to invalid value (-1).