diff options
-rw-r--r-- | src/journal-remote/journal-remote.c | 1 | ||||
-rw-r--r-- | src/journal/journald-server.c | 1 | ||||
-rw-r--r-- | src/shared/journal-file-util.c | 25 | ||||
-rw-r--r-- | src/shared/journal-file-util.h | 1 |
4 files changed, 10 insertions, 18 deletions
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 7c5ccbbea6..2d309d1236 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -86,7 +86,6 @@ static int open_output(RemoteServer *s, Writer *w, const char* host) { UINT64_MAX, &w->metrics, w->mmap, - NULL, &w->journal); if (r < 0) return log_error_errno(r, "Failed to open output journal %s: %m", filename); diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 13e8895d05..da73b668b6 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -289,7 +289,6 @@ static int server_open_journal( s->compress.threshold_bytes, metrics, s->mmap, - /* template= */ NULL, &f); else r = journal_file_open( diff --git a/src/shared/journal-file-util.c b/src/shared/journal-file-util.c index d34dbe030e..f013836a37 100644 --- a/src/shared/journal-file-util.c +++ b/src/shared/journal-file-util.c @@ -471,7 +471,6 @@ int journal_file_open_reliably( uint64_t compress_threshold_bytes, JournalMetrics *metrics, MMapCache *mmap_cache, - JournalFile *template, JournalFile **ret) { _cleanup_(journal_file_offline_closep) JournalFile *old_file = NULL; @@ -486,7 +485,7 @@ int journal_file_open_reliably( compress_threshold_bytes, metrics, mmap_cache, - template, + /* template = */ NULL, ret); if (!IN_SET(r, -EBADMSG, /* Corrupted */ @@ -512,23 +511,19 @@ int journal_file_open_reliably( /* The file is corrupted. Rotate it away and try it again (but only once) */ log_warning_errno(r, "File %s corrupted or uncleanly shut down, renaming and replacing.", fname); - if (!template) { - /* The file is corrupted and no template is specified. Try opening it read-only as the - * template before rotating to inherit its sequence number and ID. */ - r = journal_file_open(-EBADF, fname, - (open_flags & ~(O_ACCMODE|O_CREAT|O_EXCL)) | O_RDONLY, - file_flags, 0, compress_threshold_bytes, NULL, - mmap_cache, NULL, &old_file); - if (r < 0) - log_debug_errno(r, "Failed to continue sequence from file %s, ignoring: %m", fname); - else - template = old_file; - } + /* The file is corrupted. Try opening it read-only as the template before rotating to inherit its + * sequence number and ID. */ + r = journal_file_open(-EBADF, fname, + (open_flags & ~(O_ACCMODE|O_CREAT|O_EXCL)) | O_RDONLY, + file_flags, 0, compress_threshold_bytes, NULL, + mmap_cache, /* template = */ NULL, &old_file); + if (r < 0) + log_debug_errno(r, "Failed to continue sequence from file %s, ignoring: %m", fname); r = journal_file_dispose(AT_FDCWD, fname); if (r < 0) return r; return journal_file_open(-EBADF, fname, open_flags, file_flags, mode, compress_threshold_bytes, metrics, - mmap_cache, template, ret); + mmap_cache, /* template = */ old_file, ret); } diff --git a/src/shared/journal-file-util.h b/src/shared/journal-file-util.h index f9426c47d7..8df10a7927 100644 --- a/src/shared/journal-file-util.h +++ b/src/shared/journal-file-util.h @@ -17,7 +17,6 @@ int journal_file_open_reliably( uint64_t compress_threshold_bytes, JournalMetrics *metrics, MMapCache *mmap_cache, - JournalFile *template, JournalFile **ret); JournalFile* journal_file_initiate_close(JournalFile *f, Set *deferred_closes); |