mirror of
https://github.com/systemd/systemd.git
synced 2024-11-06 16:59:03 +03:00
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
This commit is contained in:
parent
7ac6c26a22
commit
7ddc2dc5e6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user