From db0d50a67d788f0163b7ea2bad17b966f1e43512 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 9 Dec 2013 10:12:42 +0000 Subject: [PATCH] * include/cygwin/stdlib.h (initstate, random, setstate, srandom): Harden _XOPEN_SOURCE guard against applications defining _XOPEN_SOURCE with empty value. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/include/cygwin/stdlib.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 359efdec9..90bc5cd3d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2013-12-09 Corinna Vinschen + + * include/cygwin/stdlib.h (initstate, random, setstate, srandom): + Harden _XOPEN_SOURCE guard against applications defining _XOPEN_SOURCE + with empty value. + 2013-12-08 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 28. diff --git a/winsup/cygwin/include/cygwin/stdlib.h b/winsup/cygwin/include/cygwin/stdlib.h index fb9c924a7..4d652fd5f 100644 --- a/winsup/cygwin/include/cygwin/stdlib.h +++ b/winsup/cygwin/include/cygwin/stdlib.h @@ -31,7 +31,9 @@ void setprogname (const char *); char *canonicalize_file_name (const char *); int unsetenv (const char *); #endif /*__STRICT_ANSI__*/ -#if !defined(__STRICT_ANSI__) || (_XOPEN_SOURCE >= 500) || (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) +#if !defined(__STRICT_ANSI__) \ + || (defined(_XOPEN_SOURCE) \ + && ((_XOPEN_SOURCE - 0 >= 500) || defined(_XOPEN_SOURCE_EXTENDED))) char *initstate (unsigned seed, char *state, size_t size); long random (void); char *setstate (const char *state);