journal-file-util: do not fail when journal_file_set_offline() called more than once

Previously, if journal_file_set_offline() is called twice with 'wait = false',
the second call triggered segfaults, as the offline_state is OFFLINE_DONE,
and journal_file_set_offline_thread_join() tries to call pthread_join()
with NULL.
This commit is contained in:
Yu Watanabe
2023-10-05 18:20:40 +09:00
parent ff95b60d1a
commit 46e98dfcc7

View File

@@ -346,9 +346,14 @@ int journal_file_set_offline(JournalFile *f, bool wait) {
/* Initiate a new offline. */
f->offline_state = OFFLINE_SYNCING;
if (wait) /* Without using a thread if waiting. */
if (wait) {
/* Without using a thread if waiting. */
journal_file_set_offline_internal(f);
else {
assert(f->offline_state == OFFLINE_DONE);
f->offline_state = OFFLINE_JOINED;
} else {
sigset_t ss, saved_ss;
int k;