summaryrefslogtreecommitdiffstats
path: root/src/resolv/async_resolv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolv/async_resolv.c')
-rw-r--r--src/resolv/async_resolv.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c
index 9c32aa7cd..dcbdd5188 100644
--- a/src/resolv/async_resolv.c
+++ b/src/resolv/async_resolv.c
@@ -1857,13 +1857,9 @@ static int reply_weight_rearrange(TALLOC_CTX *mem_ctx,
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;