summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-05 02:48:50 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-05 02:57:36 +0100
commit8266e1c04db8cabe3c68510a0c1f07c09ecdb2e8 (patch)
treedbc03ba06e2c982c32f82888ab5c6803f75927d8 /src/journal
parent2678031a179a9b91fc799f8ef951a548c66c4b49 (diff)
journald: reuse IOVEC_TOTAL_SIZE() macros where possible
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-server.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index c28aba8fd0..4613550039 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -521,12 +521,7 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
}
if (vacuumed || !shall_try_append_again(f, r)) {
- size_t size = 0;
- unsigned i;
- for (i = 0; i < n; i++)
- size += iovec[i].iov_len;
-
- log_error_errno(r, "Failed to write entry (%d items, %zu bytes), ignoring: %m", n, size);
+ log_error_errno(r, "Failed to write entry (%d items, %zu bytes), ignoring: %m", n, IOVEC_TOTAL_SIZE(iovec, n));
return;
}
@@ -539,14 +534,9 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
log_debug("Retrying write.");
r = journal_file_append_entry(f, NULL, iovec, n, &s->seqnum, NULL, NULL);
- if (r < 0) {
- size_t size = 0;
- unsigned i;
- for (i = 0; i < n; i++)
- size += iovec[i].iov_len;
-
- log_error_errno(r, "Failed to write entry (%d items, %zu bytes) despite vacuuming, ignoring: %m", n, size);
- } else
+ if (r < 0)
+ log_error_errno(r, "Failed to write entry (%d items, %zu bytes) despite vacuuming, ignoring: %m", n, IOVEC_TOTAL_SIZE(iovec, n));
+ else
server_schedule_sync(s, priority);
}