1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-22 06:50:18 +03:00

core/unit: remove path to transient unit file from unit name maps on stop

Fixes #35190.
This commit is contained in:
Yu Watanabe 2025-01-28 10:09:32 +09:00
parent d8b34aaef2
commit fce94c5c56

View File

@ -646,13 +646,11 @@ static void unit_clear_dependencies(Unit *u) {
static void unit_remove_transient(Unit *u) {
assert(u);
assert(u->manager);
if (!u->transient)
return;
if (u->fragment_path)
(void) unlink(u->fragment_path);
STRV_FOREACH(i, u->dropin_paths) {
_cleanup_free_ char *p = NULL, *pp = NULL;
@ -669,6 +667,17 @@ static void unit_remove_transient(Unit *u) {
(void) unlink(*i);
(void) rmdir(p);
}
if (u->fragment_path) {
(void) unlink(u->fragment_path);
(void) unit_file_remove_from_name_map(
&u->manager->lookup_paths,
&u->manager->unit_cache_timestamp_hash,
&u->manager->unit_id_map,
&u->manager->unit_name_map,
&u->manager->unit_path_cache,
u->fragment_path);
}
}
static void unit_free_mounts_for(Unit *u) {