From: Lennart Poettering Date: Tue, 20 Aug 2019 15:32:17 +0000 (+0200) Subject: log: don't invalidate open console fd if we can't open a new one X-Git-Tag: v243-rc2~11^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d5a1c99b25e549f44ca6f5f8006b90ee56b809f9;p=thirdparty%2Fsystemd.git log: don't invalidate open console fd if we can't open a new one --- diff --git a/src/basic/log.c b/src/basic/log.c index 6095f0fdec9..8bcc18bc809 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -87,11 +87,13 @@ static int log_open_console(void) { } if (console_fd < 3) { - console_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC); - if (console_fd < 0) - return console_fd; + int fd; - console_fd = fd_move_above_stdio(console_fd); + fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC); + if (fd < 0) + return fd; + + console_fd = fd_move_above_stdio(fd); } return 0;