From: Yu Watanabe Date: Tue, 20 Sep 2022 18:30:11 +0000 (+0900) Subject: core/device: check that no unit is ready and not simultaneously X-Git-Tag: v252-rc1~125^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4cb8afb8ff82ed55ca3667e1ccee9f3757a4a20;p=thirdparty%2Fsystemd.git core/device: check that no unit is ready and not simultaneously This should not happen, just for safety. --- diff --git a/src/core/device.c b/src/core/device.c index 21dc5890fc5..b3cf77d50c6 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -903,6 +903,13 @@ static int device_setup_units(Manager *m, sd_device *dev, Set **ready_units, Set /* Next, add/update additional .device units point to aliases and symlinks. */ (void) device_setup_extra_units(m, dev, ready_units, not_ready_units); + + /* Safety check: no unit should be in ready_units and not_ready_units simultaneously. */ + Unit *u; + SET_FOREACH(u, *not_ready_units) + if (set_remove(*ready_units, u)) + log_unit_error(u, "Cannot active and deactive simultaneously. Deactivating."); + return 0; }