This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix stdlib.h rand_r namespace (bug 20074)


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).

[The XFAIL removal depends on
<https://sourceware.org/ml/libc-alpha/2016-05/msg00093.html> (pending
review) to eliminate the other cause of failure for the test in
question.]

2016-05-10  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.

diff --git a/conform/Makefile b/conform/Makefile
index 8d381fb..47f2eb4 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -180,7 +180,6 @@ test-xfail-XPG4/fcntl.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/termios.h/conform = yes
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 5c0c982..ad9c6c8 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -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

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]