]> sourceware.org Git - glibc.git/commitdiff
* sysdeps/posix/getaddrinfo.c (struct sort_result): Add cvs/fedora-glibc-20071014T1847
authorUlrich Drepper <drepper@redhat.com>
Sun, 14 Oct 2007 17:58:03 +0000 (17:58 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 14 Oct 2007 17:58:03 +0000 (17:58 +0000)
service_order.
(rfc3484_sort): Make sure that even of qsort doesn't support
stable sorting it is stable by comparing service_order.
(getaddrinfo): Initialize service_order.

ChangeLog
sysdeps/posix/getaddrinfo.c

index c16c6ed0fa2cacb6524ae5fe43a5d753605a62fc..16d3a2e3b42b5ff54c6007ad8bb9144fa99b1ac6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-10-14  Ulrich Drepper  <drepper@redhat.com>
 
+       * sysdeps/posix/getaddrinfo.c (struct sort_result): Add
+       service_order.
+       (rfc3484_sort): Make sure that even of qsort doesn't support
+       stable sorting it is stable by comparing service_order.
+       (getaddrinfo): Initialize service_order.
+
        * include/time.h: Declare __tzset_parse_tz and __tzset_compute.
        * time/tzset.c (tzset_internal): Break TZ string parsing out into
        __tzset_parse_tz and updating of daylight, timezone, tzname into
index 221b41dd00dd8e3f606ddae790bda8bcbd1fa1ac..8f37ec5c1133303a092862d6ce6e6a6582248c38 100644 (file)
@@ -1002,6 +1002,7 @@ struct sort_result
 {
   struct addrinfo *dest_addr;
   struct sockaddr_storage source_addr;
+  size_t service_order;
   uint8_t source_addr_len;
   bool got_source_addr;
   uint8_t source_addr_flags;
@@ -1403,8 +1404,11 @@ rfc3484_sort (const void *p1, const void *p2)
     }
 
 
-  /* Rule 10: Otherwise, leave the order unchanged.  */
-  return 0;
+  /* Rule 10: Otherwise, leave the order unchanged.  To ensure this
+     compare with the value indicating the order in which the entries
+     have been received from the services.  NB: no two entries can have
+     the same order so the test will never return zero.  */
+  return a1->service_order < a2->service_order ? -1 : 1;
 }
 
 
@@ -1951,6 +1955,7 @@ getaddrinfo (const char *name, const char *service,
        {
          results[i].dest_addr = q;
          results[i].got_source_addr = false;
+         results[i].service_order = i;
 
          /* If we just looked up the address for a different
             protocol, reuse the result.  */
This page took 0.051922 seconds and 5 git commands to generate.