]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix stdlib.h rand_r namespace (bug 20074).
authorJoseph Myers <joseph@codesourcery.com>
Tue, 17 May 2016 15:48:29 +0000 (15:48 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 17 May 2016 15:48:29 +0000 (15:48 +0000)
stdlib.h declares rand_r if __USE_POSIX; i.e., POSIX.1:1990.  But
rand_r was added along with threads, so the condition should be
__USE_POSIX199506.  This patch corrects the condition.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

[BZ #20074]
* stdlib/stdlib.h (rand_r): Declare if [__USE_POSIX199506], not if
[__USE_POSIX].
* conform/Makefile (test-xfail-XPG4/stdlib.h/conform): Remove
variable.

ChangeLog
conform/Makefile
stdlib/stdlib.h

index ead0766e300baefd83733cb20c37c2682a8690f4..7d38ded1b730f6e676635b892a98cc09c6dcd2a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-05-17  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #20074]
+       * stdlib/stdlib.h (rand_r): Declare if [__USE_POSIX199506], not if
+       [__USE_POSIX].
+       * conform/Makefile (test-xfail-XPG4/stdlib.h/conform): Remove
+       variable.
+
        [BZ #20051]
        * posix/unistd.h [__USE_XOPEN_EXTENDED && !__USE_UNIX98]
        (ttyslot): Do not declare.
index ab9da786d9c137683723cbf584ff83ec32521897..8e9ad85772d08b1dc4610d2bd376f1233c56d52f 100644 (file)
@@ -174,7 +174,6 @@ test-xfail-XPG4/arpa/inet.h/conform = yes
 test-xfail-XPG4/netdb.h/conform = yes
 test-xfail-XPG4/netinet/in.h/conform = yes
 test-xfail-XPG4/signal.h/conform = yes
-test-xfail-XPG4/stdlib.h/conform = yes
 test-xfail-XPG4/sys/stat.h/conform = yes
 test-xfail-XPG4/sys/wait.h/conform = yes
 test-xfail-XPG4/ucontext.h/conform = yes
index 5c0c982ccf2ca908b25d593fe19cce1c9307b794..ad9c6c890457e534651b7c6c96152e31702a2756 100644 (file)
@@ -337,7 +337,7 @@ extern int rand (void) __THROW;
 extern void srand (unsigned int __seed) __THROW;
 __END_NAMESPACE_STD
 
-#ifdef __USE_POSIX
+#ifdef __USE_POSIX199506
 /* Reentrant interface according to POSIX.1.  */
 extern int rand_r (unsigned int *__seed) __THROW;
 #endif