summaryrefslogtreecommitdiffstats
path: root/src/basic/process-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-06-09 08:59:33 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-06-10 10:31:22 +0200
commit97033ba455c4c1e359835879eee2e3c690395792 (patch)
tree095477a2cce88b5ccc99a3ee419ba102db20945e /src/basic/process-util.c
parentdocs: point contributors to list of most recent systemd releases (diff)
downloadsystemd-97033ba455c4c1e359835879eee2e3c690395792.tar.xz
systemd-97033ba455c4c1e359835879eee2e3c690395792.zip
pager: set PR_DEATHSIG for pager to SIGINT rather than SIGTERM
"less" doesn't properly reset its terminal on SIGTERM, it does so only on SIGINT. Let's thus configure SIGINT instead of SIGTERM. I think this is something less should fix too, and clean up things correctly on SIGTERM, too. However, given that we explicitly enable SIGINT behaviour by passing "K" to $LESS I figure it makes sense if we also send SIGINT instead of SIGTERM to match it. Fixes: #16084
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r--src/basic/process-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 8cb229ca09..f6ecc7f86f 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -1301,8 +1301,8 @@ int safe_fork_full(
r, "Failed to rename process, ignoring: %m");
}
- if (flags & FORK_DEATHSIG)
- if (prctl(PR_SET_PDEATHSIG, SIGTERM) < 0) {
+ if (flags & (FORK_DEATHSIG|FORK_DEATHSIG_SIGINT))
+ if (prctl(PR_SET_PDEATHSIG, (flags & FORK_DEATHSIG_SIGINT) ? SIGINT : SIGTERM) < 0) {
log_full_errno(prio, errno, "Failed to set death signal: %m");
_exit(EXIT_FAILURE);
}