1 diff --git usertable.cpp usertable.cpp
2 index 11fd04b..a8681bd 100644
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
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)