about summary refs log tree commit diff
path: root/src/libmain
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc2
-rw-r--r--src/libmain/shared.hh3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index da5aeadeb673..8577d34a50e3 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -258,6 +258,8 @@ static void setuidInit()
     if (setuid(nixUid)) abort();
     if (setgid(nixGid)) abort();
 #endif
+
+    setuidMode = true;
 }
 
 
diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh
index 16162604a914..20262004bdbd 100644
--- a/src/libmain/shared.hh
+++ b/src/libmain/shared.hh
@@ -24,6 +24,9 @@ namespace nix {
 Path makeRootName(const Path & gcRoot, int & counter);
 void printGCWarning();
 
+/* Whether we're running setuid. */
+bool setuidMode = false;
+
 }