]> git.ipfire.org Git - thirdparty/systemd.git/commit
core/unit: do not use unit path cache in unit_need_daemon_reload()
authorNick Rosbrook <enr0n@ubuntu.com>
Wed, 7 Aug 2024 22:18:06 +0000 (18:18 -0400)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 9 Aug 2024 10:25:42 +0000 (19:25 +0900)
commit82c482d573c9d2f3ab36f7be8d32772f90f2c335
tree54e553bfbe06d0c2abefa9aa9c2e3620c5d8e942
parent79488ac0038aca5fca5b2938eb645d35015664cf
core/unit: do not use unit path cache in unit_need_daemon_reload()

When unit_need_daemon_reload() calls unit_find_dropin_paths() to check
for new drop-in configs, the manager's unit path cache is used to limit
which directories are considered. If a new drop-in directory is created,
it may not be in the unit path cache, and hence unit_need_daemon_reload()
may return false, despite a new drop-in being present. However, if a
unit path cache is not given to unit_file_find_dropin_paths() at all,
then it behaves as if the target path was found in the unit path cache.

So, to fix this, adapt unit_find_dropin_paths() to take a boolean
argument indicating whether or not to pass along the unit path cache.
Set this to false in unit_need_daemon_reload().

Fixes #31752
src/core/load-dropin.c
src/core/load-dropin.h
src/core/unit.c
test/units/TEST-07-PID1.issue-31752.sh [new file with mode: 0755]