1
0
Fork 0
mirror of https://git.freebsd.org/ports.git synced 2025-07-15 00:09:15 -04:00
ports/devel/electron22/files/patch-third__party_libxml_src_dict.c
Mikael Urankar 6a6b89a12f devel/electron22: add new port: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Build cross platform desktop apps with JavaScript, HTML, and CSS.

It's easier than you think.

If you can build a website, you can build a desktop app. Electron is a
framework for creating native applications with web technologies like
JavaScript, HTML, and CSS. It takes care of the hard parts so you can
focus on the core of your application.

WWW: https://electronjs.org/
2023-01-27 17:12:19 +01:00

41 lines
1 KiB
C

--- third_party/libxml/src/dict.c.orig 2022-10-24 13:33:33 UTC
+++ third_party/libxml/src/dict.c
@@ -137,7 +137,7 @@ static xmlMutexPtr xmlDictMutex = NULL;
static int xmlDictInitialized = 0;
#ifdef DICT_RANDOMIZATION
-#ifdef HAVE_RAND_R
+#if defined(HAVE_RAND_R) && !defined(HAVE_ARC4RANDOM)
/*
* Internal data for random function, protected by xmlDictMutex
*/
@@ -180,7 +180,7 @@ int __xmlInitializeDict(void) {
return(0);
xmlMutexLock(xmlDictMutex);
-#ifdef DICT_RANDOMIZATION
+#if defined(DICT_RANDOMIZATION) && !defined(HAVE_ARC4RANDOM)
#ifdef HAVE_RAND_R
rand_seed = time(NULL);
rand_r(& rand_seed);
@@ -200,13 +200,17 @@ int __xmlRandom(void) {
if (xmlDictInitialized == 0)
__xmlInitializeDict();
+#ifdef HAVE_ARC4RANDOM
+ ret = arc4random();
+#else
xmlMutexLock(xmlDictMutex);
-#ifdef HAVE_RAND_R
+# ifdef HAVE_RAND_R
ret = rand_r(& rand_seed);
-#else
+# else
ret = rand();
-#endif
+# endif
xmlMutexUnlock(xmlDictMutex);
+#endif
return(ret);
}
#endif