diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-10-19 23:30:50 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-10-20 13:12:53 +0200 |
commit | 8ae2c6300feffc598f1b13b9268e7312c647d19e (patch) | |
tree | 8fba7f9bba6fda3a37ca7dfb42d1135e0d843208 /src/journal | |
parent | e9c880dd2c841b4c61c6e8c194001767feed0aab (diff) |
journald,core: add short comments we we keep reopening /dev/console all the time
Just to make sure the next one reading this isn't surprised that the fd isn't
kept open. SAK and stuff...
Fix suggested:
https://github.com/systemd/systemd/pull/4366#issuecomment-253659162
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journald-console.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c index fcc9f25814..3a9fba42a3 100644 --- a/src/journal/journald-console.c +++ b/src/journal/journald-console.c @@ -102,6 +102,11 @@ void server_forward_console( tty = s->tty_path ? s->tty_path : "/dev/console"; + /* Before you ask: yes, on purpose we open/close the console for each log line we write individually. This is a + * good strategy to avoid journald getting killed by the kernel's SAK concept (it doesn't fix this entirely, + * but minimizes the time window the kernel might end up killing journald due to SAK). It also makes things + * easier for us so that we don't have to recover from hangups and suchlike triggered on the console. */ + fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC); if (fd < 0) { log_debug_errno(fd, "Failed to open %s for logging: %m", tty); |