Przeglądaj źródła

u-a: Fix lookup by name on --config

The code was wrong and not working at least on Mac OS X.
Guillem Jover 10 lat temu
rodzic
commit
cdf41bcf1d
2 zmienionych plików z 3 dodań i 3 usunięć
  1. 2 0
      debian/changelog
  2. 1 3
      utils/update-alternatives.c

+ 2 - 0
debian/changelog

@@ -43,6 +43,8 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     - Port start-stop-daemon process handling to Mac OS X.
     - Port start-stop-daemon process handling to Mac OS X.
       Based on a patch by Mo McRoberts <mo@nevali.net>.
       Based on a patch by Mo McRoberts <mo@nevali.net>.
     - Port start-stop-daemon process handling to AIX.
     - Port start-stop-daemon process handling to AIX.
+    - Fix lookup by name on update-alternatives --config. The code was wrong
+      and not working at least on Mac OS X, making the test suite to fail.
   * Perl modules:
   * Perl modules:
     - Obsolete Source-Version substvar in Dpkg::Substvars by emitting errors.
     - Obsolete Source-Version substvar in Dpkg::Substvars by emitting errors.
     - Rework keyring hooks in Dpkg::Vendor. Deprecate the keyrings hook, and
     - Rework keyring hooks in Dpkg::Vendor. Deprecate the keyrings hook, and

+ 1 - 3
utils/update-alternatives.c

@@ -1581,9 +1581,7 @@ alternative_select_choice(struct alternative *a)
 			return xstrdup(current);
 			return xstrdup(current);
 		errno = 0;
 		errno = 0;
 		idx = strtol(selection, &ret, 10);
 		idx = strtol(selection, &ret, 10);
-		if (idx < 0 || errno != 0)
-			continue;
-		if (*ret == '\0') {
+		if (idx >= 0 && errno == 0 && *ret == '\0') {
 			/* Look up by index */
 			/* Look up by index */
 			if (idx == 0) {
 			if (idx == 0) {
 				alternative_set_status(a, ALT_ST_AUTO);
 				alternative_set_status(a, ALT_ST_AUTO);