summaryrefslogtreecommitdiffstats
path: root/src/shared/install.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:09:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:09:07 +0000
commit7257648854d395257843e449a0763c31150c48b9 (patch)
tree822bdd281c8b364c220c9bebc3812aa2274008ff /src/shared/install.c
parentAdding debian version 256-2. (diff)
downloadsystemd-7257648854d395257843e449a0763c31150c48b9.tar.xz
systemd-7257648854d395257843e449a0763c31150c48b9.zip
Merging upstream version 256.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/shared/install.c')
-rw-r--r--src/shared/install.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/shared/install.c b/src/shared/install.c
index dd2bd5c..c94b456 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2282,7 +2282,9 @@ static int install_context_mark_for_removal(
else {
log_debug_errno(r, "Unit %s not found, removing name.", i->name);
r = install_changes_add(changes, n_changes, r, i->path ?: i->name, NULL);
- if (r < 0)
+ /* In case there's no unit, we still want to remove any leftover symlink, even if
+ * the unit might have been removed already, hence treating ENOENT as non-fatal. */
+ if (r != -ENOENT)
return r;
}
} else if (r < 0) {
@@ -2874,9 +2876,13 @@ static int do_unit_file_disable(
r = install_info_add(&ctx, *name, NULL, lp->root_dir, /* auxiliary= */ false, &info);
if (r >= 0)
r = install_info_traverse(&ctx, lp, info, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, NULL);
-
- if (r < 0)
- return install_changes_add(changes, n_changes, r, *name, NULL);
+ if (r < 0) {
+ r = install_changes_add(changes, n_changes, r, *name, NULL);
+ /* In case there's no unit, we still want to remove any leftover symlink, even if
+ * the unit might have been removed already, hence treating ENOENT as non-fatal. */
+ if (r != -ENOENT)
+ return r;
+ }
/* If we enable multiple units, some with install info and others without,
* the "empty [Install] section" warning is not shown. Let's make the behavior