696e2f2
From e59e123d9c0692b6104deea954e1a2db172e22e1 Mon Sep 17 00:00:00 2001
696e2f2
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
696e2f2
Date: Thu, 18 Aug 2016 21:39:39 -0400
696e2f2
Subject: [PATCH] Revert "pid1: reconnect to the console before being
696e2f2
 re-executed"
696e2f2
696e2f2
This reverts commit affd7ed1a923b0df8479cff1bd9eafb625fdaa66.
696e2f2
696e2f2
> So it looks like make_console_stdio() has bad side effect. More specifically it
696e2f2
> does a TIOCSCTTY ioctl (via acquire_terminal()) which sees to disturb the
696e2f2
> process which was using/owning the console.
696e2f2
696e2f2
Fixes #3842.
696e2f2
https://bugs.debian.org/834367
696e2f2
https://bugzilla.redhat.com/show_bug.cgi?id=1367766
696e2f2
696e2f2
(cherry picked from commit bd64d82c1c0e3fe2a5f9b3dd9132d62834f50b2d)
696e2f2
---
696e2f2
 src/core/main.c | 6 +++---
696e2f2
 1 file changed, 3 insertions(+), 3 deletions(-)
696e2f2
696e2f2
diff --git a/src/core/main.c b/src/core/main.c
696e2f2
index f2adca7d2b..f59a55f166 100644
696e2f2
--- a/src/core/main.c
696e2f2
+++ b/src/core/main.c
696e2f2
@@ -2016,9 +2016,6 @@ finish:
696e2f2
                                 log_error_errno(r, "Failed to switch root, trying to continue: %m");
696e2f2
                 }
696e2f2
 
696e2f2
-                /* Reopen the console */
696e2f2
-                (void) make_console_stdio();
696e2f2
-
696e2f2
                 args_size = MAX(6, argc+1);
696e2f2
                 args = newa(const char*, args_size);
696e2f2
 
696e2f2
@@ -2066,6 +2063,9 @@ finish:
696e2f2
                 arg_serialization = safe_fclose(arg_serialization);
696e2f2
                 fds = fdset_free(fds);
696e2f2
 
696e2f2
+                /* Reopen the console */
696e2f2
+                (void) make_console_stdio();
696e2f2
+
696e2f2
                 for (j = 1, i = 1; j < (unsigned) argc; j++)
696e2f2
                         args[i++] = argv[j];
696e2f2
                 args[i++] = NULL;
696e2f2
-- 
696e2f2
2.9.0
696e2f2