]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: if RefreshOnReload= is explicitly enabled, allow reload even without...
authorMike Yuan <me@yhndnzj.com>
Sun, 14 Dec 2025 16:55:04 +0000 (17:55 +0100)
committerMike Yuan <me@yhndnzj.com>
Tue, 10 Feb 2026 20:54:13 +0000 (21:54 +0100)
This was originally brought up by @poettering. If the process
loads stuff on demand and flushes them out after each use,
or actively monitors file changes, they can be reloaded
by merely refreshing the resources.

src/core/service.c

index 49dd82ebb8ce2d7392f5846c9fae116b8e73f994..255e86cfb5617c69cd4e3980dde784492a8bcc6c 100644 (file)
@@ -3297,7 +3297,10 @@ static bool service_can_reload(Unit *u) {
         Service *s = ASSERT_PTR(SERVICE(u));
 
         return s->exec_command[SERVICE_EXEC_RELOAD] ||
-                s->type == SERVICE_NOTIFY_RELOAD;
+                s->type == SERVICE_NOTIFY_RELOAD ||
+                (s->refresh_on_reload_set &&
+                 (service_get_effective_reload_extensions(s) ||
+                  service_get_effective_reload_credentials(s)));
 }
 
 static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, const ExecCommand *current) {