summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-08-20 17:32:17 +0200
committerLennart Poettering <lennart@poettering.net>2019-08-20 17:32:17 +0200
commitd5a1c99b25e549f44ca6f5f8006b90ee56b809f9 (patch)
tree670993d85c74076b8bfa1cd13358df93b2f43042 /src
parentterminal-util: add fallback logic to make_console_stdio() (diff)
downloadsystemd-d5a1c99b25e549f44ca6f5f8006b90ee56b809f9.tar.xz
systemd-d5a1c99b25e549f44ca6f5f8006b90ee56b809f9.zip
log: don't invalidate open console fd if we can't open a new one
Diffstat (limited to 'src')
-rw-r--r--src/basic/log.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/basic/log.c b/src/basic/log.c
index 6095f0fdec..8bcc18bc80 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;