From f54bcca5c16bea2ed6b694c7944cb0ae679fbfaf Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=83=C2=83=C3=82=C2=A9r=C3=83=C2=83=C3=82=C2=A9my=20Rose?= =?utf8?q?n?= Date: Sat, 22 Jul 2017 17:30:57 +0200 Subject: [PATCH] unit : allow any unit which propagates reloads to be reloaded --- src/core/unit.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index 2037de6d332..9eda9643f60 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1759,19 +1759,25 @@ int unit_reload(Unit *u) { unit_add_to_dbus_queue(u); + if (!UNIT_VTABLE(u)->reload) { + /* Unit doesn't have a reload function, but we need to propagate the reload anyway */ + unit_notify(u, unit_active_state(u), unit_active_state(u), true); + return 0; + } + return UNIT_VTABLE(u)->reload(u); } bool unit_can_reload(Unit *u) { assert(u); - if (!UNIT_VTABLE(u)->reload) - return false; + if (UNIT_VTABLE(u)->can_reload) + return UNIT_VTABLE(u)->can_reload(u); - if (!UNIT_VTABLE(u)->can_reload) + if (!set_isempty(u->dependencies[UNIT_PROPAGATES_RELOAD_TO])) return true; - return UNIT_VTABLE(u)->can_reload(u); + return UNIT_VTABLE(u)->reload; } static void unit_check_unneeded(Unit *u) { -- 2.47.3