]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/manager: do not re-init Manager.lookup_paths when manager_reload() 33833/head
authorMike Yuan <me@yhndnzj.com>
Wed, 24 Jul 2024 19:24:13 +0000 (21:24 +0200)
committerMike Yuan <me@yhndnzj.com>
Sat, 7 Sep 2024 12:52:50 +0000 (14:52 +0200)
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.

src/core/manager.c

index 81db683553f652dd191f594416300000daac890a..2dddc797222686472135417ebee221bd6e121869 100644 (file)
@@ -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;