fix-udevmon-configuration-job-path.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. From d3a5d661b80f3597368f517ebaeddfdfaafc1bf2 Mon Sep 17 00:00:00 2001
  2. From: xd1le <elisp.vim@gmail.com>
  3. Date: Mon, 28 Aug 2017 00:19:09 +1000
  4. Subject: [PATCH] fix udevmon configuration job path
  5. For some reason, the udevmon job $PATH seems to be empty (or otherwise
  6. seems to point to `/no-such-path`). This commit fixes that by setting
  7. its $PATH to the same $PATH that the parent udevmon process has.
  8. ---
  9. udevmon.cpp | 5 ++++-
  10. 1 file changed, 4 insertions(+), 1 deletion(-)
  11. diff --git a/udevmon.cpp b/udevmon.cpp
  12. index ebdd909..b523efd 100644
  13. --- a/udevmon.cpp
  14. +++ b/udevmon.cpp
  15. @@ -237,8 +237,11 @@ private:
  16. case 0: {
  17. char *command[] = {(char *)"sh", (char *)"-c",
  18. (char *)job.c_str(), nullptr};
  19. + std::string path = getenv("PATH");
  20. std::string variables = "DEVNODE=" + devnode;
  21. - char *environment[] = {(char *)variables.c_str(), nullptr};
  22. + std::string pathenv = "PATH=" + path;
  23. + char *environment[] = {(char *)variables.c_str(),
  24. + (char *)pathenv.c_str(), nullptr};
  25. execvpe(command[0], command, environment);
  26. std::fprintf(stderr,
  27. R"(exec failed for devnode %s, job "%s" )"
  28. --
  29. 2.14.1