journal-file: fix archiving offline journals
authorVito Caputo <vcaputo@pengaru.com>
Sun, 29 Nov 2020 00:28:08 +0000 (16:28 -0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 12 Mar 2021 16:35:56 +0000 (17:35 +0100)
commit50e6c3b2e547aa29d1c5e160f9e5aa4dc9e07168
tree2887c7aeeaa24e606a2ab6fdb91b0d15e98048f4
parent67e03400e881929ca0c940a4a51e76d3c68b6c29
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

(cherry picked from commit bb1296b55a222cbab24d533006e730529009258c)
src/journal/journal-file.c