X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-file.c;h=622eb165e131d32eea9f2c79bc71e6511cdf924d;hb=ae6c3cc009a21df4b51851fb8fe3fde0b7d6d8f0;hp=d06dbc2f753397efd6408a0d451fd6ab914cc948;hpb=4743015db6ad394bd43efadb0651e3906b4efc25;p=elogind.git diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index d06dbc2f7..622eb165e 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -1292,7 +1292,7 @@ void journal_file_post_change(JournalFile *f) { __sync_synchronize(); if (ftruncate(f->fd, f->last_stat.st_size) < 0) - log_error("Failed to truncate file to its own size: %m"); + log_error_errno(errno, "Failed to truncate file to its own size: %m"); } static int entry_item_cmp(const void *_a, const void *_b) { @@ -1380,9 +1380,10 @@ static void chain_cache_put( if (array == first) return; - if (ordered_hashmap_size(h) >= CHAIN_CACHE_MAX) + if (ordered_hashmap_size(h) >= CHAIN_CACHE_MAX) { ci = ordered_hashmap_steal_first(h); - else { + assert(ci); + } else { ci = new(ChainCacheItem, 1); if (!ci) return; @@ -1656,7 +1657,7 @@ static int generic_array_bisect( } } - if (k > n) { + if (k >= n) { if (direction == DIRECTION_UP) { i = n; subtract_one = true; @@ -2526,7 +2527,7 @@ int journal_file_open( * currently no usable API to query this, hence let's * emulate this via extended attributes. If extended * attributes are not supported we'll just skip this, - * and rely solely on mtime/atime/ctime of the file.*/ + * and rely solely on mtime/atime/ctime of the file. */ crtime = htole64((uint64_t) now(CLOCK_REALTIME)); fsetxattr(f->fd, "user.crtime_usec", &crtime, sizeof(crtime), XATTR_CREATE);