log: don't invalidate open console fd if we can't open a new one

This commit is contained in:
Lennart Poettering 2019-08-20 17:32:17 +02:00
parent 9281e70375
commit d5a1c99b25

View file

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