From c29efcd13b9b72fd40fa5254cde3bb7a3e92a1c4 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 11 Jun 2019 12:09:48 +0200 Subject: [PATCH] xbps_alternatives_unregister: fix xbps_set_cb_state(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the !current branch, "first" wasn't initialized so it displayed garbage: Removing `pinentry-tty-1.1.0_5' ... Removing 'pinentry' alternatives group symlink: pinentry pinentry-tty-1.1.0_5: unregistered 'pinentry' alternatives group Switched 'pinentry' alternatives group to 'p o@�' Creating 'pinentry' alternatives group symlink: pinentry -> /usr/bin/pinentry-tty Removed file `/usr/bin/pinentry-tty' Removed `pinentry-tty-1.1.0_5' successfully. With my fix: Removing `pinentry-tty-1.1.0_5' ... Removing 'pinentry' alternatives group symlink: pinentry pinentry-tty-1.1.0_5: unregistered 'pinentry' alternatives group Switched 'pinentry' alternatives group to 'pinentry' Creating 'pinentry' alternatives group symlink: pinentry -> /usr/bin/pinentry-tty Removed file `/usr/bin/pinentry-tty' Removed `pinentry-tty-1.1.0_5' successfully. Signed-off-by: Juan RP --- lib/package_alternatives.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/package_alternatives.c b/lib/package_alternatives.c index ef32f85d..a91fd117 100644 --- a/lib/package_alternatives.c +++ b/lib/package_alternatives.c @@ -366,10 +366,10 @@ xbps_alternatives_unregister(struct xbps_handle *xhp, xbps_dictionary_t pkgd) if (!update && !current) continue; + xbps_array_get_cstring_nocopy(array, 0, &first); + if (!current) { /* get the new alternative group package */ - first = NULL; - xbps_array_get_cstring_nocopy(array, 0, &first); curpkgd = xbps_pkgdb_get_pkg(xhp, first); assert(curpkgd); }