diff options
author | Christian Hesse <mail@eworm.de> | 2018-03-28 21:58:10 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-03-28 21:58:10 +0200 |
commit | 106f12a08fcacef713438fc055872592399deeed (patch) | |
tree | caa68961d62a8151ce633e09ab8c4ccfbf98e2b0 /src | |
parent | 2d684e65aaacc9f995236843597ddee96ed8aa70 (diff) | |
download | systemd-106f12a08fcacef713438fc055872592399deeed.tar.gz |
systemd-inhibit: ignore signal interrupt from keyboard (#8569)
By default both processes, systemd-inhibit and the forked one, receive
the signals. Pressing Ctrl+C on the keyboard results in SIGINT being
sent to the processes, followed by SIGTERM being sent to the forked
process when systemd-inhibit exits. This can cause trouble when the
forked process does not clean up properly but exit immediately.
Instead make systemd-inhibit ignore SIGINT, leaving it to the forked
process to clean up and exit.
Diffstat (limited to 'src')
-rw-r--r-- | src/login/inhibit.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/login/inhibit.c b/src/login/inhibit.c index 6b5d9c29b9..c118421e6b 100644 --- a/src/login/inhibit.c +++ b/src/login/inhibit.c @@ -254,6 +254,9 @@ int main(int argc, char *argv[]) { _cleanup_free_ char *w = NULL; pid_t pid; + /* Ignore SIGINT and allow the forked process to receive it */ + (void) ignore_signals(SIGINT, -1); + if (!arg_who) arg_who = w = strv_join(argv + optind, " "); |