summaryrefslogtreecommitdiff
path: root/src/shared/log.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2013-02-15 22:41:19 +0100
committerMichal Schmidt <mschmidt@redhat.com>2013-02-16 01:16:32 +0100
commit4a01181e460686d8b4a543b1dfa7f77c9e3c5ab8 (patch)
tree3248df44ca33554086929b91555b071e27cbe1b8 /src/shared/log.c
parente57b477183259eac2d56c5f9d9820170afb1a5e6 (diff)
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".
Diffstat (limited to 'src/shared/log.c')
-rw-r--r--src/shared/log.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index 293c261f9e..ff2dd45350 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -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++;
}