core: fix mtime calculation of dropin files
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 3 Mar 2021 23:36:24 +0000 (00:36 +0100)
committerMichael Biebl <biebl@debian.org>
Thu, 11 Mar 2021 17:09:35 +0000 (17:09 +0000)
commit418c65a9df27cc4e6b81692048a15bfbf3866f6f
treeb1e9e4312bbadeba05b289291ca6b2e0c39b4e96
parentb4c6e82b8dac79818e018eaf644f80cf759a77bb
core: fix mtime calculation of dropin files

Nominally, the bug was in unit_load_dropin(), which just took the last mtime
instead of calculating the maximum. But instead of adding code to wrap the
loop, this patch goes in the other direction.

All (correct) callers of config_parse() followed a very similar pattern to
calculate the maximum mtime. So let's simplify things by making config_parse()
assume that mtime is initialized and update it to the maximum. This makes all
the callers that care about mtime simpler and also fixes the issue in
unit_load_dropin().

config_parse_many_nulstr() and config_parse_many() are different, because it
makes sense to call them just once, and current ret_mtime behaviour make sense.

Fixes #17730, https://bugzilla.redhat.com/show_bug.cgi?id=1933137.

(cherry picked from commit da46a1bc3cd28ac36114002c216196dae004b05c)

Gbp-Pq: Name core-fix-mtime-calculation-of-dropin-files.patch
src/core/load-dropin.c
src/shared/conf-parser.c
src/shared/conf-parser.h