mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
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.
This commit is contained in:
parent
9132b9bd72
commit
18d9a4466c
1 changed files with 8 additions and 2 deletions
|
@ -257,8 +257,14 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
/* Hackily help 'local-store.cc' find our 'guix-authenticate' program, which
|
/* Hackily help 'local-store.cc' find our 'guix-authenticate' program, which
|
||||||
is known as 'OPENSSL_PATH' here. */
|
is known as 'OPENSSL_PATH' here. */
|
||||||
std::string search_path (getenv ("PATH"));
|
std::string search_path;
|
||||||
search_path = settings.nixLibexecDir + ":" + search_path;
|
search_path = settings.nixLibexecDir;
|
||||||
|
if (getenv ("PATH") != NULL)
|
||||||
|
{
|
||||||
|
search_path += ":";
|
||||||
|
search_path += getenv ("PATH");
|
||||||
|
}
|
||||||
|
|
||||||
setenv ("PATH", search_path.c_str (), 1);
|
setenv ("PATH", search_path.c_str (), 1);
|
||||||
|
|
||||||
/* Use our substituter by default. */
|
/* Use our substituter by default. */
|
||||||
|
|
Loading…
Reference in a new issue