From: Mike Yuan Date: Wed, 24 Jul 2024 19:24:13 +0000 (+0200) Subject: core/manager: do not re-init Manager.lookup_paths when manager_reload() X-Git-Tag: v257-rc1~512^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F33833%2Fhead;p=thirdparty%2Fsystemd.git core/manager: do not re-init Manager.lookup_paths when manager_reload() Follow-up for 99aad9a2b9e2c06023a2043976fd9395332ff097 The commit changed lookup_paths_init_or_warn() call to be fatal to manager_reload(), but invoke_main_loop() assumes that manager_reload() would only return recoverable error, and put the manager back to MANAGER_OK in that case, which is spurious. Looking at it more, it appears to be utterly unnecessary to reinitialize LookupPaths here, given that nothing during the reload process would change the search dirs. Let's drop the path altogether hence. --- diff --git a/src/core/manager.c b/src/core/manager.c index 81db683553f..2dddc797222 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -3707,21 +3707,14 @@ int manager_reload(Manager *m) { manager_clear_jobs_and_units(m); lookup_paths_flush_generator(&m->lookup_paths); - lookup_paths_done(&m->lookup_paths); exec_shared_runtime_vacuum(m); dynamic_user_vacuum(m, false); m->uid_refs = hashmap_free(m->uid_refs); m->gid_refs = hashmap_free(m->gid_refs); - r = lookup_paths_init_or_warn(&m->lookup_paths, m->runtime_scope, 0, NULL); - if (r < 0) - return r; - (void) manager_run_environment_generators(m); (void) manager_run_generators(m); - lookup_paths_log(&m->lookup_paths); - /* We flushed out generated files, for which we don't watch mtime, so we should flush the old map. */ manager_free_unit_name_maps(m); m->unit_file_state_outdated = false;