Skip to content

Commit

Permalink
* sysdeps/posix/getaddrinfo.c (rfc3484_sort): Store result of
Browse files Browse the repository at this point in the history
	native interface lookup in all the relevant places.
  • Loading branch information
Ulrich Drepper committed Jan 10, 2008
1 parent 99f0579 commit 49029a6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 12 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2008-01-10 Ulrich Drepper <drepper@redhat.com>

* sysdeps/posix/getaddrinfo.c (rfc3484_sort): Store result of
native interface lookup in all the relevant places.

2008-01-10 Jakub Jelinek <jakub@redhat.com>
Ulrich Drepper <drepper@redhat.com>

Expand Down
51 changes: 39 additions & 12 deletions sysdeps/posix/getaddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1363,27 +1363,54 @@ rfc3484_sort (const void *p1, const void *p2, void *arg)
(most?) cases. */
if (a1->index != a2->index)
{
if (a1->native == -1 || a2->native == -1)
int a1_native = a1->native;
int a2_native = a2->native;

if (a1_native == -1 || a2_native == -1)
{
/* If we do not have the information use 'native' as the
default. */
int a1_native = 0;
int a2_native = 0;
__check_native (a1->index, &a1_native, a2->index, &a2_native);
uint32_t a1_index;
if (a1_native == -1)
{
/* If we do not have the information use 'native' as
the default. */
a1_native = 0;
a1_index = a1->index;
}
else
a1_index = 0xffffffffu;

uint32_t a2_index;
if (a2_native == -1)
{
/* If we do not have the information use 'native' as
the default. */
a2_native = 0;
a2_index = a2->index;
}
else
a2_index = 0xffffffffu;

__check_native (a1_index, &a1_native, a2_index, &a2_native);

/* Fill in the results in all the records. */
for (int i = 0; i < src->nresults; ++i)
{
if (a1->native == -1 && src->results[i].index == a1->index)
if (src->results[i].index == a1_index)
{
assert (src->results[i].native == -1
|| src->results[i].native == a1_native);
src->results[i].native = a1_native;
if (a2->native == -1 && src->results[i].index == a2->index)
}
else if (src->results[i].index == a2_index)
{
assert (src->results[i].native == -1
|| src->results[i].native == a2_native);
src->results[i].native = a2_native;
}
}
}

if (a1->native && !a2->native)
if (a1_native && !a2_native)
return -1;
if (!a1->native && a2->native)
if (!a1_native && a2_native)
return 1;
}
}
Expand Down

0 comments on commit 49029a6

Please sign in to comment.