mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
core/unit: do not load drop-in configs for masked unit files
Otherwise, ExecXYZ= given by drop-ins may be added to a masked unit, then commands may be unexpectedly executed. For example, if an ExecStop= is set in a drop-in for a running unit, then 'systemctl mask --now' for the unit try to invoke the command specified in ExecStop=. Fixes #38802.
This commit is contained in:
@@ -1422,6 +1422,9 @@ int unit_load_fragment_and_dropin(Unit *u, bool fragment_required) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (u->load_state == UNIT_MASKED)
|
||||
return 0;
|
||||
|
||||
if (u->load_state == UNIT_STUB) {
|
||||
if (fragment_required)
|
||||
return -ENOENT;
|
||||
|
||||
Reference in New Issue
Block a user