If we encounter an inconsistency in a file, let's just
ignore it. Otherwise, after previous patch, we would try,
and fail, to use this file in every invocation of sd_journal_next
or sd_journal_previous that happens afterwards.
#define DEFAULT_DATA_THRESHOLD (64*1024)
#define DEFAULT_DATA_THRESHOLD (64*1024)
+static void remove_file_real(sd_journal *j, JournalFile *f);
+
static bool journal_pid_changed(sd_journal *j) {
assert(j);
static bool journal_pid_changed(sd_journal *j) {
assert(j);
r = next_beyond_location(j, f, direction, &o, &p);
if (r < 0) {
log_debug("Can't iterate through %s, ignoring: %s", f->path, strerror(-r));
r = next_beyond_location(j, f, direction, &o, &p);
if (r < 0) {
log_debug("Can't iterate through %s, ignoring: %s", f->path, strerror(-r));
+ remove_file_real(j, f);
continue;
} else if (r == 0)
continue;
continue;
} else if (r == 0)
continue;
}
static int remove_file(sd_journal *j, const char *prefix, const char *filename) {
}
static int remove_file(sd_journal *j, const char *prefix, const char *filename) {
+ _cleanup_free_ char *path;
JournalFile *f;
assert(j);
JournalFile *f;
assert(j);
return -ENOMEM;
f = hashmap_get(j->files, path);
return -ENOMEM;
f = hashmap_get(j->files, path);
+ remove_file_real(j, f);
+ return 0;
+}
+
+static void remove_file_real(sd_journal *j, JournalFile *f) {
+ assert(j);
+ assert(f);
+
hashmap_remove(j->files, f->path);
log_debug("File %s removed.", f->path);
hashmap_remove(j->files, f->path);
log_debug("File %s removed.", f->path);
journal_file_close(f);
j->current_invalidate_counter ++;
journal_file_close(f);
j->current_invalidate_counter ++;
}
static int add_directory(sd_journal *j, const char *prefix, const char *dirname) {
}
static int add_directory(sd_journal *j, const char *prefix, const char *dirname) {