biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / system / incron / default_path.patch
blobae173ea29e62a7e4039251eb550e0537547e28c1
1 diff --git usertable.cpp usertable.cpp
2 index 11fd04b..a8681bd 100644
3 --- a/usertable.cpp
4 +++ b/usertable.cpp
5 @@ -43,9 +43,6 @@
6 #define DONT_FOLLOW(mask) (false)
7 #endif // IN_DONT_FOLLOW
9 -// this is not enough, but...
10 -#define DEFAULT_PATH "/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin"
13 PROC_MAP UserTable::s_procMap;
15 @@ -597,12 +594,20 @@ void UserTable::RunAsUser(std::string cmd) const
16 if (clearenv() != 0)
17 goto failed;
19 + // try to recreate the user path as best as possible
20 + std::string DEFAULT_PATH;
21 + DEFAULT_PATH += "/run/wrappers/bin:";
22 + DEFAULT_PATH += pwd->pw_dir;
23 + DEFAULT_PATH += "/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/etc/profiles/per-user/";
24 + DEFAULT_PATH += pwd->pw_name;
25 + DEFAULT_PATH += "/bin";
27 if ( setenv("LOGNAME", pwd->pw_name, 1) != 0
28 || setenv("USER", pwd->pw_name, 1) != 0
29 || setenv("USERNAME", pwd->pw_name, 1) != 0
30 || setenv("HOME", pwd->pw_dir, 1) != 0
31 || setenv("SHELL", pwd->pw_shell, 1) != 0
32 - || setenv("PATH", DEFAULT_PATH, 1) != 0)
33 + || setenv("PATH", DEFAULT_PATH.c_str(), 1) != 0)
35 goto failed;