dpkg/update-alternatives-slavetomaster.patch

29 lines
1.0 KiB
Diff
Raw Normal View History

From 472d6aad992b2d459c31449ff7d36e20a76e4adf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
Date: Mon, 3 Jan 2022 13:19:13 +0100
Subject: [PATCH 4/4] update-alternatives-slavetomaster
---
utils/update-alternatives.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index eee59d590..41fdce430 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -2035,7 +2035,10 @@ alternative_prepare_install(struct alternative *a, const char *choice)
/* Drop unused slave. */
fn = xasprintf("%s/%s", altdir, sl->name);
if (alternative_path_can_remove(sl->link))
- alternative_add_commit_op(a, OPCODE_RM, sl->link, NULL);
+ if (strcmp(sl->link, a->master_link))
+ alternative_add_commit_op(a, OPCODE_RM, sl->link, NULL);
+ else
+ warning("not removing %s, now master", a->master_link);
else
warning(_("not removing %s since it's not a symlink"),
sl->link);
--
2.33.1