chiark / gitweb /
journal: fix iteration when we go backwards from the beginning of an array chain...
authorLennart Poettering <lennart@poettering.net>
Tue, 26 Nov 2013 23:58:39 +0000 (00:58 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 26 Nov 2013 23:58:39 +0000 (00:58 +0100)
src/journal/journal-file.c

index 27cd16fc007f72fded4907bbd00fdcc0c36d340e..409be76dd42f47561c73897a913bceebaab6e1fb 100644 (file)
@@ -1687,7 +1687,7 @@ found:
                 return 0;
 
         /* Let's cache this item for the next invocation */
-        chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t, i + (subtract_one ? -1 : 0));
+        chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t, subtract_one ? (i > 0 ? i-1 : (uint64_t) -1) : i);
 
         if (subtract_one && i == 0)
                 p = last_p;