olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh677316-qsort_r.patch

00db10
commit bef8fd6013f7d398661077340753c745a8939279
00db10
Author: Joseph Myers <joseph@codesourcery.com>
00db10
Date:   Wed Nov 12 22:33:41 2014 +0000
00db10
00db10
    Fix qsort_r namespace (bug 17571).
00db10
00db10
diff --git a/include/stdlib.h b/include/stdlib.h
00db10
index c20ce9da58bd2cdf..152c12fe9cb41509 100644
00db10
--- a/include/stdlib.h
00db10
+++ b/include/stdlib.h
00db10
@@ -37,7 +37,8 @@ extern __typeof (secure_getenv) __libc_secure_getenv;
00db10
 libc_hidden_proto (__libc_secure_getenv)
00db10
 libc_hidden_proto (bsearch)
00db10
 libc_hidden_proto (qsort)
00db10
-libc_hidden_proto (qsort_r)
00db10
+extern __typeof (qsort_r) __qsort_r;
00db10
+libc_hidden_proto (__qsort_r)
00db10
 libc_hidden_proto (lrand48_r)
00db10
 libc_hidden_proto (wctomb)
00db10
 
00db10
diff --git a/nscd/gai.c b/nscd/gai.c
00db10
index 060933293838c4ee..018b449339813df5 100644
00db10
--- a/nscd/gai.c
00db10
+++ b/nscd/gai.c
00db10
@@ -29,6 +29,7 @@
00db10
 #define __sendto sendto
00db10
 #define __strchrnul strchrnul
00db10
 #define __getline getline
00db10
+#define __qsort_r qsort_r
00db10
 /* nscd uses 1MB or 2MB thread stacks.  */
00db10
 #define __libc_use_alloca(size) (size <= __MAX_ALLOCA_CUTOFF)
00db10
 
00db10
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
00db10
index a37be36e6ad5a279..afd4b2959fc830f0 100644
00db10
--- a/posix/tst-rfc3484-2.c
00db10
+++ b/posix/tst-rfc3484-2.c
00db10
@@ -9,6 +9,7 @@
00db10
 #define __inet_aton inet_aton
00db10
 #define __gethostbyaddr_r gethostbyaddr_r
00db10
 #define __gethostbyname2_r gethostbyname2_r
00db10
+#define __qsort_r qsort_r
00db10
 
00db10
 void
00db10
 attribute_hidden
00db10
diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c
00db10
index 493e76015c74be9e..92efecd242a0baa3 100644
00db10
--- a/posix/tst-rfc3484-3.c
00db10
+++ b/posix/tst-rfc3484-3.c
00db10
@@ -9,6 +9,7 @@
00db10
 #define __inet_aton inet_aton
00db10
 #define __gethostbyaddr_r gethostbyaddr_r
00db10
 #define __gethostbyname2_r gethostbyname2_r
00db10
+#define __qsort_r qsort_r
00db10
 
00db10
 void
00db10
 attribute_hidden
00db10
diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
00db10
index db3ae1b7bb86406a..8e886d987fd42b1d 100644
00db10
--- a/posix/tst-rfc3484.c
00db10
+++ b/posix/tst-rfc3484.c
00db10
@@ -9,6 +9,7 @@
00db10
 #define __inet_aton inet_aton
00db10
 #define __gethostbyaddr_r gethostbyaddr_r
00db10
 #define __gethostbyname2_r gethostbyname2_r
00db10
+#define __qsort_r qsort_r
00db10
 
00db10
 void
00db10
 attribute_hidden
00db10
diff --git a/stdlib/msort.c b/stdlib/msort.c
00db10
index e419734cd634ba5c..6f4b846b05fea8b9 100644
00db10
--- a/stdlib/msort.c
00db10
+++ b/stdlib/msort.c
00db10
@@ -162,7 +162,7 @@ msort_with_tmp (const struct msort_param *p, void *b, size_t n)
00db10
 
00db10
 
00db10
 void
00db10
-qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void *arg)
00db10
+__qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void *arg)
00db10
 {
00db10
   size_t size = n * s;
00db10
   char *tmp = NULL;
00db10
@@ -298,12 +298,13 @@ qsort_r (void *b, size_t n, size_t s, __compar_d_fn_t cmp, void *arg)
00db10
     }
00db10
   free (tmp);
00db10
 }
00db10
-libc_hidden_def (qsort_r)
00db10
+libc_hidden_def (__qsort_r)
00db10
+weak_alias (__qsort_r, qsort_r)
00db10
 
00db10
 
00db10
 void
00db10
 qsort (void *b, size_t n, size_t s, __compar_fn_t cmp)
00db10
 {
00db10
-  return qsort_r (b, n, s, (__compar_d_fn_t) cmp, NULL);
00db10
+  return __qsort_r (b, n, s, (__compar_d_fn_t) cmp, NULL);
00db10
 }
00db10
 libc_hidden_def (qsort)
00db10
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
00db10
index b1c72fda9d2aa365..a678d8d7e8b23d1d 100644
00db10
--- a/sysdeps/posix/getaddrinfo.c
00db10
+++ b/sysdeps/posix/getaddrinfo.c
00db10
@@ -2639,11 +2639,11 @@ getaddrinfo (const char *name, const char *service,
00db10
 	  __libc_lock_lock (lock);
00db10
 	  if (__libc_once_get (old_once) && gaiconf_reload_flag)
00db10
 	    gaiconf_reload ();
00db10
-	  qsort_r (order, nresults, sizeof (order[0]), rfc3484_sort, &src;;
00db10
+	  __qsort_r (order, nresults, sizeof (order[0]), rfc3484_sort, &src;;
00db10
 	  __libc_lock_unlock (lock);
00db10
 	}
00db10
       else
00db10
-	qsort_r (order, nresults, sizeof (order[0]), rfc3484_sort, &src;;
00db10
+	__qsort_r (order, nresults, sizeof (order[0]), rfc3484_sort, &src;;
00db10
 
00db10
       /* Queue the results up as they come out of sorting.  */
00db10
       q = p = results[order[0]].dest_addr;