X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-file.c;h=01b7f89fef58b8d36d7c9ebf2fa68a0be5f42912;hb=fed67c38e3;hp=d06dbc2f753397efd6408a0d451fd6ab914cc948;hpb=4743015db6ad394bd43efadb0651e3906b4efc25;p=elogind.git diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index d06dbc2f7..01b7f89fe 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -445,7 +445,7 @@ int journal_file_move_to_object(JournalFile *f, int type, uint64_t offset, Objec return -EBADMSG; if (s > sizeof(ObjectHeader)) { - r = journal_file_move_to(f, o->object.type, false, offset, s, &t); + r = journal_file_move_to(f, type_to_context(type), false, offset, s, &t); if (r < 0) return r; @@ -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);