From d45b4f4a4328ced5e291e6c309437599647c02e0 Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Wed, 7 Jul 2021 19:43:16 +0100 Subject: 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. --- linux/SystemdMeter.c | 18 +++++++++--------- 1 file 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]); -- cgit v1.2.3