From 1c90fabccc0b859d9a357c96bfbc0c19a4ce17da Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 20 Aug 2004 15:31:46 +0000 Subject: [PATCH] * Unbreak programs that are not setuid (such as nix-hash). --- src/libmain/shared.cc | 3 +++ 1 file changed, 3 insertions(+) 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. */