]> granicus.if.org Git - libexpat/commitdiff
Only define _CRT_RAND_S when not already defined.
authorbungeman <bungeman@chromium.org>
Wed, 18 Sep 2019 14:39:05 +0000 (10:39 -0400)
committerGitHub <noreply@github.com>
Wed, 18 Sep 2019 14:39:05 +0000 (10:39 -0400)
There exist builds which go out of their way to define _CRT_RAND_S for everything by forcing it into the list of macros defined on the command line to the compiler. Unfortunately, something like "-D_CRT_RAND_S" implies _CRT_RAND_S is defined to be '1' and defining it to be empty produces a redefinition.

Since the intention here is to ensure that _CRT_RAND_S is always defined, only define it if it isn't already defined.

expat/lib/xmlparse.c

index e740f0e19c7d4a1b7a36b46491a2157da334f408..08a04c65de6c78b6ede434a286a78b10a3c09aa8 100644 (file)
@@ -36,7 +36,9 @@
 
 #ifdef _WIN32
 /* force stdlib to define rand_s() */
-#  define _CRT_RAND_S
+#  if ! defined(_CRT_RAND_S)
+#    define _CRT_RAND_S
+#  endif
 #endif
 
 #include <stddef.h>