aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-04-09 23:05:42 +0200
committerLudovic Courtès <ludo@gnu.org>2014-04-09 23:05:42 +0200
commit18d9a4466ce1c622c13810e25ccf73ae937b1716 (patch)
tree563b91b6b2b19d31a786fb587737529c0c50e8c2 /nix
parent9132b9bd72304e6fe659b3cb31700bdc49696caf (diff)
downloadgnu-guix-18d9a4466ce1c622c13810e25ccf73ae937b1716.tar
gnu-guix-18d9a4466ce1c622c13810e25ccf73ae937b1716.tar.gz
daemon: Don't abort when $PATH is undefined.
* nix/nix-daemon/guix-daemon.cc (main): Check whether getenv ("PATH") returns NULL before blindly initializing 'search_path'. Before that 'guix-daemon' would abort when run in an environment where 'PATH' is undefined.
Diffstat (limited to 'nix')
-rw-r--r--nix/nix-daemon/guix-daemon.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 71815169f7..0bb9f7559c 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -257,8 +257,14 @@ main (int argc, char *argv[])
/* Hackily help 'local-store.cc' find our 'guix-authenticate' program, which
is known as 'OPENSSL_PATH' here. */
- std::string search_path (getenv ("PATH"));
- search_path = settings.nixLibexecDir + ":" + search_path;
+ std::string search_path;
+ search_path = settings.nixLibexecDir;
+ if (getenv ("PATH") != NULL)
+ {
+ search_path += ":";
+ search_path += getenv ("PATH");
+ }
+
setenv ("PATH", search_path.c_str (), 1);
/* Use our substituter by default. */