summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-17 03:31:45 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-17 03:31:45 +0200
commit9499b235b9817720af506e7898f0df2efb249939 (patch)
tree8acd72755f16a4e0375da37a5e6bd54546a03883 /src
parent8630d370239482b6e4913e81011440b173e41b79 (diff)
log: print at to one target at max
Diffstat (limited to 'src')
-rw-r--r--src/log.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/log.c b/src/log.c
index d6f4e34613..d0d98ddf75 100644
--- a/src/log.c
+++ b/src/log.c
@@ -331,7 +331,7 @@ static int log_dispatch(
do {
char *e;
- int k;
+ int k = 0;
buffer += strspn(buffer, NEWLINE);
@@ -344,24 +344,26 @@ static int log_dispatch(
if (log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
log_target == LOG_TARGET_SYSLOG) {
- if ((r = write_to_syslog(level, file, line, func, buffer)) < 0) {
+ if ((k = write_to_syslog(level, file, line, func, buffer)) < 0) {
log_close_syslog();
log_open_kmsg();
- } else if (r > 0)
+ } else if (k > 0)
r++;
}
- if (log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
- log_target == LOG_TARGET_KMSG) {
+ if (k <= 0 &&
+ (log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
+ log_target == LOG_TARGET_KMSG)) {
- if ((r = write_to_kmsg(level, file, line, func, buffer)) < 0) {
+ if ((k = write_to_kmsg(level, file, line, func, buffer)) < 0) {
log_close_kmsg();
log_open_console();
- } else if (r > 0)
+ } else if (k > 0)
r++;
}
- if ((k = write_to_console(level, file, line, func, buffer)) < 0)
+ if (k <= 0 &&
+ (k = write_to_console(level, file, line, func, buffer)) < 0)
return k;
buffer = e;