]> git.ipfire.org Git - thirdparty/systemd.git/commit
inhibit: fix borked double logging on error 40271/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 4 Jan 2026 11:25:32 +0000 (12:25 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 4 Jan 2026 13:07:57 +0000 (14:07 +0100)
commit4a4be1015b1a3c9efa974cbb1dbe1c776aab4f05
tree8cf2306721b22e3bb13eddbf8292d4b3ee9c7719
parent22aa8c48799b51df7e8b176bbec5645174fd9261
inhibit: fix borked double logging on error

Previously, if execution failed, we'd log at error level both from the
child and the parent, and we were using a bogus variable for the argument
name:
$ build/systemd-inhibit list
Failed to execute : No such file or directory
list failed with exit status 1.

In general, we can and should assume that the program the user is calling
is well behaved, so it'll log the error on its own if appropriate. So we
shouldn't log on "normal errors", but only if the child is terminated by
a signal.

And since the program name is controlled by the user, use quotes everywhere
to avoid ambiguity.

Now:
$ build/systemd-inhibit false
(nothing)
$ build/systemd-inhibit bash -c 'kill -SEGV $$'
src/basic/process-util.c:895: 'bash' terminated by signal SEGV.
src/basic/process-util.c
src/login/inhibit.c