projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6e2d361
)
nspawn: surrender controlling terminal to PID2 when using the PID1 stub
author
Nicolas Douma
<nicolas@serveur.io>
Tue, 17 Sep 2019 03:07:00 +0000
(
05:07
+0200)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 3 Oct 2019 10:13:03 +0000
(12:13 +0200)
src/nspawn/nspawn-stub-pid1.c
patch
|
blob
|
history
diff --git
a/src/nspawn/nspawn-stub-pid1.c
b/src/nspawn/nspawn-stub-pid1.c
index
ebf4f0f
..
0589685
100644
(file)
--- a/
src/nspawn/nspawn-stub-pid1.c
+++ b/
src/nspawn/nspawn-stub-pid1.c
@@
-53,6
+53,12
@@
int stub_pid1(sd_id128_t uuid) {
assert_se(sigfillset(&fullmask) >= 0);
assert_se(sigprocmask(SIG_BLOCK, &fullmask, &oldmask) >= 0);
+ /* Surrender the terminal this stub may control so that child processes can have a controlling terminal
+ * without resorting to setsid hacks. */
+ r = ioctl(STDIN_FILENO, TIOCNOTTY);
+ if (r < 0 && errno != ENOTTY)
+ return log_error_errno(errno, "Failed to surrender controlling terminal: %m");
+
pid = fork();
if (pid < 0)
return log_error_errno(errno, "Failed to fork child pid: %m");