summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2016-08-25 00:45:04 +0200
committerGuillem Jover <guillem@debian.org>2016-10-30 04:45:34 +0100
commitcdf41bcf1d3551ffa0ce1cc85be69d4ea9251893 (patch)
treebbba03c8cd511d8cc72aabdf4b708c3643619f0b /utils
parente12ad320d4c073016d77acefdb71ebf4e34b82be (diff)
downloaddpkg-cdf41bcf1d3551ffa0ce1cc85be69d4ea9251893.tar.gz
u-a: Fix lookup by name on --config
The code was wrong and not working at least on Mac OS X.
Diffstat (limited to 'utils')
-rw-r--r--utils/update-alternatives.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 5dc3213a7..02a3a83db 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1581,9 +1581,7 @@ alternative_select_choice(struct alternative *a)
return xstrdup(current);
errno = 0;
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 */
if (idx == 0) {
alternative_set_status(a, ALT_ST_AUTO);