summary refs log tree commit diff
path: root/nix/nix-daemon/guix-daemon.cc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-12-16 18:13:59 +0100
committerLudovic Courtès <ludo@gnu.org>2012-12-16 18:13:59 +0100
commite2332e8aa7240451fd596140d242dc062c93230b (patch)
tree096481977e4bb8bfcabba77d3a2997af1b456d6d /nix/nix-daemon/guix-daemon.cc
parent72ce03739e24d9e2908342fc0e6384e6dfb802f5 (diff)
downloadguix-e2332e8aa7240451fd596140d242dc062c93230b.tar.gz
daemon: Warn against running as root without `--build-users-group'.
* nix/nix-daemon/guix-daemon.cc (main): Recommend using
  `--build-users-group' when running  as root without a build users
  group.
Diffstat (limited to 'nix/nix-daemon/guix-daemon.cc')
-rw-r--r--nix/nix-daemon/guix-daemon.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 0e72b1d219..459c794f5d 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -25,6 +25,8 @@
 
 #include <stdlib.h>
 #include <argp.h>
+#include <unistd.h>
+#include <sys/types.h>
 
 /* Variables used by `nix-daemon.cc'.  */
 volatile ::sig_atomic_t blockInt;
@@ -176,6 +178,10 @@ main (int argc, char *argv[])
 
   argp_parse (&argp, argc, argv, 0, 0, 0);
 
+  if (geteuid () == 0 && settings.buildUsersGroup.empty ())
+    fprintf (stderr, "warning: running as root is highly recommended, "
+	     "unless `--build-users-group' is used\n");
+
   argvSaved = argv;
   run (nothing);
 }