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.
This commit is contained in:
Scott Olson 2021-07-07 19:43:16 +01:00 committed by BenBE
parent df435931b6
commit d45b4f4a43
1 changed files with 9 additions and 9 deletions

View File

@ -219,15 +219,15 @@ static void updateViaExec(void) {
exit(1); exit(1);
dup2(fdnull, STDERR_FILENO); dup2(fdnull, STDERR_FILENO);
close(fdnull); close(fdnull);
execl("/bin/systemctl", execlp("systemctl",
"/bin/systemctl", "systemctl",
"show", "show",
"--property=SystemState", "--property=SystemState",
"--property=NFailedUnits", "--property=NFailedUnits",
"--property=NNames", "--property=NNames",
"--property=NJobs", "--property=NJobs",
"--property=NInstalledJobs", "--property=NInstalledJobs",
NULL); NULL);
exit(127); exit(127);
} }
close(fdpair[1]); close(fdpair[1]);