aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-08-20 15:31:46 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-08-20 15:31:46 +0000
commit1c90fabccc0b859d9a357c96bfbc0c19a4ce17da (patch)
treeaaf86a49f833c304b721bf858501c3c507f3b86c /src/libmain
parente77fbe0fa2f7c2cfaee734dba049f0d8dd3dae15 (diff)
* Unbreak programs that are not setuid (such as nix-hash).
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index df56a77cf..e0e9328dd 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -177,6 +177,9 @@ void switchToNixUser()
{
#if SETUID_HACK
+ /* Don't do anything if this is not a setuid binary. */
+ if (getuid() == geteuid()) return;
+
/* Here we set the uid and gid to the Nix user and group,
respectively, IF the current (real) user is a member of the Nix
group. Otherwise we just drop all privileges. */