log: minor fixes

Most important is a fix to negate the error number if necessary, before we
first access it.
This commit is contained in:
Lennart Poettering 2016-08-30 21:02:36 +02:00
parent 398a50cdd1
commit 0474ef7b3e
1 changed files with 5 additions and 5 deletions

View File

@ -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;