about summary refs log tree commit diff
path: root/posix/tst-rfc3484-2.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-2.c
parentab355d9aa5186937757b20b93f7d52ea3926427a (diff)
downloadglibc-0efd19566da2186c571dae4807afbd4db3356e0a.tar.gz
glibc-0efd19566da2186c571dae4807afbd4db3356e0a.tar.xz
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-2.c')
-rw-r--r--posix/tst-rfc3484-2.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
index d29f0725cc..56c0277b17 100644
--- a/posix/tst-rfc3484-2.c
+++ b/posix/tst-rfc3484-2.c
@@ -100,31 +100,32 @@ do_test (void)
 
 
   struct sort_result results[2];
+  size_t order[2];
 
   results[0].dest_addr = &ai1;
   results[0].got_source_addr = true;
   results[0].source_addr_len = sizeof (so1);
   results[0].source_addr_flags = 0;
-  results[0].service_order = 0;
   results[0].prefixlen = 16;
   results[0].index = 0;
   memcpy (&results[0].source_addr, &so1, sizeof (so1));
+  order[0] = 0;
 
   results[1].dest_addr = &ai2;
   results[1].got_source_addr = true;
   results[1].source_addr_len = sizeof (so2);
   results[1].source_addr_flags = 0;
-  results[1].service_order = 1;
   results[1].prefixlen = 16;
   results[1].index = 0;
   memcpy (&results[1].source_addr, &so2, sizeof (so2));
+  order[1] = 1;
 
 
   struct sort_result_combo combo = { .results = results, .nresults = 2 };
-  qsort_r (results, 2, sizeof (results[0]), rfc3484_sort, &combo);
+  qsort_r (order, 2, sizeof (order[0]), rfc3484_sort, &combo);
 
   int result = 0;
-  if (results[0].dest_addr->ai_family == AF_INET6)
+  if (results[order[0]].dest_addr->ai_family == AF_INET6)
     {
       puts ("wrong order in first test");
       result |= 1;
@@ -136,24 +137,24 @@ do_test (void)
   results[1].got_source_addr = true;
   results[1].source_addr_len = sizeof (so1);
   results[1].source_addr_flags = 0;
-  results[1].service_order = 1;
   results[1].prefixlen = 16;
   results[1].index = 0;
   memcpy (&results[1].source_addr, &so1, sizeof (so1));
+  order[1] = 1;
 
   results[0].dest_addr = &ai2;
   results[0].got_source_addr = true;
   results[0].source_addr_len = sizeof (so2);
   results[0].source_addr_flags = 0;
-  results[0].service_order = 0;
   results[0].prefixlen = 16;
   results[0].index = 0;
   memcpy (&results[0].source_addr, &so2, sizeof (so2));
+  order[0] = 0;
 
 
-  qsort_r (results, 2, sizeof (results[0]), rfc3484_sort, &combo);
+  qsort_r (order, 2, sizeof (order[0]), rfc3484_sort, &combo);
 
-  if (results[0].dest_addr->ai_family == AF_INET6)
+  if (results[order[0]].dest_addr->ai_family == AF_INET6)
     {
       puts ("wrong order in second test");
       result |= 1;