chiark / gitweb /
journald: don't choke on journal files with no cutoff date
[elogind.git] / src / journal / sd-journal.c
index 77469e9ebd342319cc7118132d360c0471424b3c..c3f19ca697a4396150c8c43d99b5dd4ee00822a0 100644 (file)
@@ -1116,7 +1116,7 @@ static int add_file(sd_journal *j, const char *prefix, const char *filename) {
                 return 0;
         }
 
-        r = journal_file_open(path, O_RDONLY, 0, NULL, &f);
+        r = journal_file_open(path, O_RDONLY, 0, NULL, NULL, &f);
         free(path);
 
         if (r < 0) {
@@ -1950,6 +1950,8 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
                 usec_t fr, t;
 
                 r = journal_file_get_cutoff_realtime_usec(f, &fr, &t);
+                if (r == -ENOENT)
+                        continue;
                 if (r < 0)
                         return r;
                 if (r == 0)
@@ -1987,6 +1989,8 @@ _public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot
                 usec_t fr, t;
 
                 r = journal_file_get_cutoff_monotonic_usec(f, boot_id, &fr, &t);
+                if (r == -ENOENT)
+                        continue;
                 if (r < 0)
                         return r;
                 if (r == 0)