diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-08-30 21:02:36 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-10-07 20:14:38 +0200 |
commit | 0474ef7b3ed81f0e568b88d0d84d3ab6446561d0 (patch) | |
tree | 9e256bb3726d8950b537473610934659109b9d2f /src | |
parent | 398a50cdd198d2573566f44c39c335fb8a3749bf (diff) |
log: minor fixes
Most important is a fix to negate the error number if necessary, before we
first access it.
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/log.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/basic/log.c b/src/basic/log.c index 49b4598b7c..6a8dad311d 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -133,7 +133,7 @@ static int create_log_socket(int type) { if (fd < 0) return -errno; - fd_inc_sndbuf(fd, SNDBUF_SIZE); + (void) fd_inc_sndbuf(fd, SNDBUF_SIZE); /* We need a blocking fd here since we'd otherwise lose messages way too early. However, let's not hang forever in the @@ -343,7 +343,7 @@ static int write_to_console( return 0; if (log_target == LOG_TARGET_CONSOLE_PREFIXED) { - sprintf(prefix, "<%i>", level); + xsprintf(prefix, "<%i>", level); IOVEC_SET_STRING(iovec[n++], prefix); } @@ -563,6 +563,9 @@ static int log_dispatch( assert(buffer); + if (error < 0) + error = -error; + if (log_target == LOG_TARGET_NULL) return -error; @@ -570,9 +573,6 @@ static int log_dispatch( if ((level & LOG_FACMASK) == 0) level = log_facility | LOG_PRI(level); - if (error < 0) - error = -error; - do { char *e; int k = 0; |