summaryrefslogtreecommitdiff
path: root/src/basic/process-util.c
diff options
context:
space:
mode:
authorShawn Landden <slandden@gmail.com>2018-01-04 03:37:15 -0800
committerLennart Poettering <lennart@poettering.net>2018-01-04 12:37:15 +0100
commit7ddc2dc5e67bf0d4ace73161d6a3cde0ea85c62b (patch)
tree12ae26815b30d8885525ac68b48a747d14430de2 /src/basic/process-util.c
parent7ac6c26a22294b3276953c635ac1e91b5d03db18 (diff)
downloadsystemd-7ddc2dc5e67bf0d4ace73161d6a3cde0ea85c62b.tar.gz
fix machinectl shell (in machined) (#7785)
4c253ed broke machined $machinectl shell arch Failed to get shell PTY: Input/output error Closes: #7779 v2: do not drop DEATHSIG flag
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r--src/basic/process-util.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 05373689ea..7da22f4a9d 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -1237,10 +1237,14 @@ int safe_fork_full(
}
if (flags & FORK_DEATHSIG) {
+ pid_t ppid;
/* Let's see if the parent PID is still the one we started from? If not, then the parent
* already died by the time we set PR_SET_PDEATHSIG, hence let's emulate the effect */
- if (getppid() != original_pid) {
+ ppid = getppid();
+ if (ppid == 0)
+ /* Parent is in a differn't PID namespace. */;
+ else if (ppid != original_pid) {
log_debug("Parent died early, raising SIGTERM.");
(void) raise(SIGTERM);
_exit(EXIT_FAILURE);