aboutsummaryrefslogtreecommitdiff
path: root/posix/tst-rfc3484.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-01-10 20:00:52 +0000
committerUlrich Drepper <drepper@redhat.com>2008-01-10 20:00:52 +0000
commit0efd19566da2186c571dae4807afbd4db3356e0a (patch)
tree8ffce6d9985b00b967db1eca0c0b3cfafc2265eb /posix/tst-rfc3484.c
parentab355d9aa5186937757b20b93f7d52ea3926427a (diff)
downloadglibc-0efd19566da2186c571dae4807afbd4db3356e0a.tar
glibc-0efd19566da2186c571dae4807afbd4db3356e0a.tar.gz
glibc-0efd19566da2186c571dae4807afbd4db3356e0a.tar.bz2
glibc-0efd19566da2186c571dae4807afbd4db3356e0a.zip
* sysdeps/posix/getaddrinfo.c (sort_results): Remove service_order
field. Use sockaddr_in6 for source_addr. (get_scope): Change type of parameter to sockaddr_in6. Adjust. (match_prefix): Likewise. (get_label): Likewise. (get_precedence): Likewise. (rfc3484_sort): Change to use indirect access to results array. Adjust to use of sockaddr_in6. Replace service_order test with simple index comparison. (getaddrinfo): Define order array. Initialize it. Don't initialize service_order field. Adjust qsort_t calls. Access sorted result array indirectly through order array. * posix/tst-rfc3484.c: Adjust for change of rfc3484_sort. * posix/tst-rfc3484-2.c: Likewise. * posix/tst-rfc3484-3.c: Likewise.
Diffstat (limited to 'posix/tst-rfc3484.c')
-rw-r--r--posix/tst-rfc3484.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
index fe06255759..4df5b2951b 100644
--- a/posix/tst-rfc3484.c
+++ b/posix/tst-rfc3484.c
@@ -64,6 +64,7 @@ struct sockaddr_in addrs[] =
#define naddrs (sizeof (addrs) / sizeof (addrs[0]))
static struct addrinfo ais[naddrs];
static struct sort_result results[naddrs];
+static size_t order[naddrs];
static int expected[naddrs] =
{
@@ -100,18 +101,19 @@ do_test (void)
memcpy(&results[i].source_addr, &so, sizeof (so));
results[i].source_addr_len = sizeof (so);
results[i].source_addr_flags = 0;
- results[i].service_order = i;
results[i].prefixlen = 8;
results[i].index = 0;
+
+ order[i] = i;
}
struct sort_result_combo combo = { .results = results, .nresults = naddrs };
- qsort_r (results, naddrs, sizeof (results[0]), rfc3484_sort, &combo);
+ qsort_r (order, naddrs, sizeof (order[0]), rfc3484_sort, &combo);
int result = 0;
for (int i = 0; i < naddrs; ++i)
{
- struct in_addr addr = ((struct sockaddr_in *) (results[i].dest_addr->ai_addr))->sin_addr;
+ struct in_addr addr = ((struct sockaddr_in *) (results[order[i]].dest_addr->ai_addr))->sin_addr;
int here = memcmp (&addr, &addrs[expected[i]].sin_addr,
sizeof (struct in_addr));