about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/inputmethods/interception-tools/fix-udevmon-configuration-job-path.patch
blob: 469c96647d69f480a3c6e12207d688bd26f8bb28 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From d3a5d661b80f3597368f517ebaeddfdfaafc1bf2 Mon Sep 17 00:00:00 2001
From: xd1le <elisp.vim@gmail.com>
Date: Mon, 28 Aug 2017 00:19:09 +1000
Subject: [PATCH] fix udevmon configuration job path

For some reason, the udevmon job $PATH seems to be empty (or otherwise
seems to point to `/no-such-path`). This commit fixes that by setting
its $PATH to the same $PATH that the parent udevmon process has.
---
 udevmon.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/udevmon.cpp b/udevmon.cpp
index ebdd909..b523efd 100644
--- a/udevmon.cpp
+++ b/udevmon.cpp
@@ -237,8 +237,11 @@ private:
             case 0: {
                 char *command[] = {(char *)"sh", (char *)"-c",
                                    (char *)job.c_str(), nullptr};
+                std::string path = getenv("PATH");
                 std::string variables = "DEVNODE=" + devnode;
-                char *environment[]   = {(char *)variables.c_str(), nullptr};
+                std::string pathenv = "PATH=" + path;
+                char *environment[] = {(char *)variables.c_str(),
+                                       (char *)pathenv.c_str(), nullptr};
                 execvpe(command[0], command, environment);
                 std::fprintf(stderr,
                              R"(exec failed for devnode %s, job "%s" )"
-- 
2.14.1