diff options
author | Pavel Březina <pbrezina@redhat.com> | 2014-07-10 13:37:37 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-07-14 15:05:04 +0200 |
commit | 2be2220f15b2a819a80b07c8881822ef87053c69 (patch) | |
tree | 822b7923b864c137c4f6436e0128086d528878b6 /src/resolv | |
parent | da6ee4b16f57d24f63c09efa74ead7f7cf315a55 (diff) | |
download | sssd-2be2220f15b2a819a80b07c8881822ef87053c69.tar.gz sssd-2be2220f15b2a819a80b07c8881822ef87053c69.tar.xz sssd-2be2220f15b2a819a80b07c8881822ef87053c69.zip |
resolv: fix server sort by weight
When the server list consist only from servers with zero weight the
output list contained only one server.
Resolves:
https://fedorahosted.org/sssd/ticket/2357
Reviewed-by: Pavel Reichl <preichl@redhat.com>
Diffstat (limited to 'src/resolv')
-rw-r--r-- | src/resolv/async_resolv.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c index 38fa84d9f..f93612440 100644 --- a/src/resolv/async_resolv.c +++ b/src/resolv/async_resolv.c @@ -2093,13 +2093,9 @@ static int reply_weight_rearrange(int len, r = *(start); prev = NULL; while (r != NULL) { - if (r->weight == 0) { + if (r->weight == 0 && r != *start) { /* remove from the old list */ - if (prev) { - prev->next = r->next; - } else { - *start = r->next; - } + prev->next = r->next; /* add to the head of the new list */ tmp = r; |