forked from pool/libxslt
* Regressions: - extensions: Readd call to xmlCheckFilename with older libxml2 * Improvments: - utils: Don't use deprecated xmlCharEncodingHandler member - transform: Handle filesystem paths after libxml2 changes - locale: Work around issue with FreeBSD's strxfrm_l * Build systems: - cmake: Add LIBXSLT_WITH_PROGRAMS option (Don Olmstead) - cmake: Fix HAVE_GCRYPT check - Update to 1.1.41: * Removals: - autotools: Stop installing libxslt.m4 - autotools: Remove RPM build * Improvements: - libxslt: Set _FILE_OFFSET_BITS to 64 - xsltproc: Remove unneeded includes - include: Don't define ATTRIBUTE_UNUSED in public header - xsltproc: Make "-" read from stdin * Build systems: - cmake: Adjust paths for UNIX or UNIX-like target systems (Daniel E) * Tests: - cmake: Link testplugin with libxml2 - tests: Link testplugin with libxml2 - tests: Fix expected error after libxml2 change - runtest: Switch to xmlFormatError - fuzz: Avoid accessing internal struct members - Update to 1.1.40: * Removals: - xsltproc: remove maxparserdepth option (Mike Dalessio) OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxslt?expand=0&rev=107
45 lines
972 B
Diff
45 lines
972 B
Diff
commit 047a0fd99e64c554c4edf44cc67ee765b09af017
|
|
Author: Marcus Meissner <meissner@suse.de>
|
|
Date: Tue Apr 4 16:27:39 2017 +0200
|
|
|
|
initialize the random seed
|
|
|
|
Index: libxslt-v1.1.36/libexslt/math.c
|
|
===================================================================
|
|
--- libxslt-v1.1.36.orig/libexslt/math.c
|
|
+++ libxslt-v1.1.36/libexslt/math.c
|
|
@@ -12,6 +12,12 @@
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
|
|
+#ifdef HAVE_UNISTD_H
|
|
+#include <unistd.h>
|
|
+#endif
|
|
+#include <fcntl.h>
|
|
+#include <time.h>
|
|
+
|
|
#include "exslt.h"
|
|
|
|
/**
|
|
@@ -460,6 +468,20 @@ static double
|
|
exsltMathRandom (void) {
|
|
double ret;
|
|
int num;
|
|
+ long seed;
|
|
+ static int randinit = 0;
|
|
+
|
|
+ if (!randinit) {
|
|
+ int fd = open("/dev/urandom",O_RDONLY);
|
|
+
|
|
+ seed = time(NULL); /* just in case /dev/urandom is not there */
|
|
+ if (fd != -1) {
|
|
+ read (fd, &seed, sizeof(seed));
|
|
+ close (fd);
|
|
+ }
|
|
+ srand(seed);
|
|
+ randinit = 1;
|
|
+ }
|
|
|
|
num = rand();
|
|
ret = (double)num / (double)RAND_MAX;
|