729b61a8d0
Fixes #126681.
29 lines
1.4 KiB
Diff
29 lines
1.4 KiB
Diff
diff --git a/udevmon.cpp b/udevmon.cpp
|
|
index 70a28be..60fcbe2 100644
|
|
--- a/udevmon.cpp
|
|
+++ b/udevmon.cpp
|
|
@@ -101,7 +101,11 @@ struct cmd {
|
|
for (size_t j = 0; j < cmds[i].size(); ++j)
|
|
command[j] = const_cast<char *>(cmds[i][j].c_str());
|
|
command[cmds[i].size()] = nullptr;
|
|
- char *environment[] = {nullptr};
|
|
+ std::string path_env = "PATH=";
|
|
+ path_env += std::getenv("PATH");
|
|
+ char *environment[] = {
|
|
+ const_cast<char *>(path_env.c_str()),
|
|
+ nullptr};
|
|
setpgid(0, 0);
|
|
execvpe(command[0], command.get(), environment);
|
|
std::string e = "exec failed for \"";
|
|
@@ -348,7 +352,10 @@ struct job {
|
|
command[j] = const_cast<char *>(cmds[i][j].c_str());
|
|
command[cmds[i].size()] = nullptr;
|
|
std::string variables = "DEVNODE=" + devnode;
|
|
+ std::string path_env = "PATH=";
|
|
+ path_env += std::getenv("PATH");
|
|
char *environment[] = {
|
|
+ const_cast<char *>(path_env.c_str()),
|
|
const_cast<char *>(variables.c_str()), nullptr};
|
|
setpgid(0, 0);
|
|
execvpe(command[0], command.get(), environment);
|