diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/libmain/shared.cc | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 563738217..b7eb905f9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = bin2c boost libutil libstore libmain nix-store nix-hash \ SETUID_PROGS = nix-store nix-instantiate nix-env install-exec-hook: if SETUID_HACK -if HAVE_SETRESUID +if HAVE_SETREUID cd $(DESTDIR)$(bindir) && chown @NIX_USER@ $(SETUID_PROGS) \ && chgrp @NIX_GROUP@ $(SETUID_PROGS) && chmod ug+s $(SETUID_PROGS) else diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index a5c45d853..d0ea3aab8 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -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. */ |