1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

log: fix fallbacks to kmsg

write_to_journal() returns 0 if journal_fd is closed and nothing is
written. We need to make sure we'll try log_open_kmsg() then to make the
fallback work for "journal-or-kmsg".
This commit is contained in:
Michal Schmidt 2013-02-15 22:41:19 +01:00
parent e57b477183
commit 4a01181e46

View File

@ -541,11 +541,11 @@ static int log_dispatch(
k = write_to_journal(level, file, line, func,
object_name, object, buffer);
if (k < 0) {
if (k != -EAGAIN)
if (k <= 0) {
if (k < 0 && k != -EAGAIN)
log_close_journal();
log_open_kmsg();
} else if (k > 0)
} else
r++;
}
@ -554,11 +554,11 @@ static int log_dispatch(
k = write_to_syslog(level, file, line, func,
object_name, object, buffer);
if (k < 0) {
if (k != -EAGAIN)
if (k <= 0) {
if (k < 0 && k != -EAGAIN)
log_close_syslog();
log_open_kmsg();
} else if (k > 0)
} else
r++;
}
@ -571,10 +571,11 @@ static int log_dispatch(
k = write_to_kmsg(level, file, line, func,
object_name, object, buffer);
if (k < 0) {
log_close_kmsg();
if (k <= 0) {
if (k < 0 && k != -EAGAIN)
log_close_kmsg();
log_open_console();
} else if (k > 0)
} else
r++;
}