summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Olson <scott@solson.me>2021-07-07 19:43:16 +0100
committerBenBE <BenBE@geshi.org>2021-07-15 10:21:12 +0200
commitd45b4f4a4328ced5e291e6c309437599647c02e0 (patch)
tree587f9116eca08087a91fc05d570a163ccea377b5
parentdf435931b649de42f518e62b598f95df7eed04e2 (diff)
Use PATH lookup for systemctl in systemd meter
Before this change, the systemd meter was broken on distros like NixOS, which have systemctl in PATH, but not at /bin/systemctl. After the change, it works on all my NixOS machines.
-rw-r--r--linux/SystemdMeter.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/linux/SystemdMeter.c b/linux/SystemdMeter.c
index 8ffb6130..245bb7b2 100644
--- a/linux/SystemdMeter.c
+++ b/linux/SystemdMeter.c
@@ -219,15 +219,15 @@ static void updateViaExec(void) {
exit(1);
dup2(fdnull, STDERR_FILENO);
close(fdnull);
- execl("/bin/systemctl",
- "/bin/systemctl",
- "show",
- "--property=SystemState",
- "--property=NFailedUnits",
- "--property=NNames",
- "--property=NJobs",
- "--property=NInstalledJobs",
- NULL);
+ execlp("systemctl",
+ "systemctl",
+ "show",
+ "--property=SystemState",
+ "--property=NFailedUnits",
+ "--property=NNames",
+ "--property=NJobs",
+ "--property=NInstalledJobs",
+ NULL);
exit(127);
}
close(fdpair[1]);