mirror of
https://github.com/NixOS/nix
synced 2025-06-27 04:21:16 +02:00
* Use setre[ug]id() instead of setres[ug]id(), since the former is
more common than the latter (which exists only on Linux and FreeBSD). We don't really care about dropping the saved IDs since there apparently is no way to quiry them in any case, so it can't influence the build (unlike the effective IDs which are checked by Perl for instance).
This commit is contained in:
parent
e043fc7d0b
commit
5396304c73
5 changed files with 88 additions and 35 deletions
|
@ -169,9 +169,9 @@ static void initAndRun(int argc, char * * argv)
|
|||
}
|
||||
|
||||
|
||||
#if HAVE_SETRESUID
|
||||
#define _setuid(uid) setresuid(uid, uid, uid)
|
||||
#define _setgid(gid) setresgid(gid, gid, gid)
|
||||
#if HAVE_SETREUID
|
||||
#define _setuid(uid) setreuid(uid, uid)
|
||||
#define _setgid(gid) setregid(gid, gid)
|
||||
#else
|
||||
/* Only works properly when run by root. */
|
||||
#define _setuid(uid) setuid(uid)
|
||||
|
@ -208,7 +208,7 @@ void switchToNixUser()
|
|||
/* !!! Apparently it is unspecified whether getgroups() includes
|
||||
the effective gid. In that case the following test is always
|
||||
true *if* the program is installed setgid (which we do when we
|
||||
have setresuid()). On Linux this doesn't appear to be the
|
||||
have setreuid()). On Linux this doesn't appear to be the
|
||||
case, but we should switch to the real gid before doing this
|
||||
test, and then switch back to the saved gid. */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue