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.
This commit is contained in:
Franck Bui 2016-06-13 16:10:06 +02:00
parent 2065ca699b
commit affd7ed1a9
1 changed files with 3 additions and 3 deletions

View File

@ -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;