journal-file: fix archiving offline journals
authorVito Caputo <vcaputo@pengaru.com>
Sun, 29 Nov 2020 00:28:08 +0000 (16:28 -0800)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Feb 2021 22:09:41 +0000 (23:09 +0100)
commitbb1296b55a222cbab24d533006e730529009258c
tree88f657b5d1a0738ffc69d81541e31d39de6aa554
parent356b7a58f3541b014b1385757ab179b50d072603
journal-file: fix archiving offline journals

The existing set_offline() short-circuit erroneously included
when f->archive was true and header->state was STATE_OFFLINE.

This commit makes the short-circuit f->archive aware, so it will
only catch scenarios where there's not an offlining in progress
and the header state matches the target state of either archived
or offline.

Fixes https://github.com/systemd/systemd/issues/17770
src/libsystemd/sd-journal/journal-file.c