From affd7ed1a923b0df8479cff1bd9eafb625fdaa66 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Mon, 13 Jun 2016 16:10:06 +0200 Subject: [PATCH] pid1: reconnect to the console before being re-executed When re-executed, reconnect the console to PID1's stdios as it was the case when PID1 was initially started by the kernel. --- src/core/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 93098daa9b..cef7575937 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1967,6 +1967,9 @@ finish: log_error_errno(r, "Failed to switch root, trying to continue: %m"); } + /* Reopen the console */ + (void) make_console_stdio(); + args_size = MAX(6, argc+1); args = newa(const char*, args_size); @@ -2018,9 +2021,6 @@ finish: arg_serialization = safe_fclose(arg_serialization); fds = fdset_free(fds); - /* Reopen the console */ - (void) make_console_stdio(); - for (j = 1, i = 1; j < (unsigned) argc; j++) args[i++] = argv[j]; args[i++] = NULL;