libxslt/libxslt-random-seed.patch
David Anes 5637cefd7f Accepting request 997692 from home:david.anes:daps_test
- Update to 1.1.36:
  * Removals and deprecations
    + Remove SVN keyword anchors
    + Remove CVS and SVN-related code
    + Remove README.cvs-commits
    + Remove ChangeLog
    + Remove xsltwin32config.h
  * Improvements
    + Simplify xsltexports.h and exsltexports.h
    + Don't overlink executables with gcrypt
    + Fix quadratic behavior with variables and parameters
    + Remove case labels with XPointer location types
    + Add configure~ to .gitignore
    + Stop calling deprecated libxml2 functions
  * Portability
    + Use portable python shebangs (David Seifert)
    + Remove useless __CYGWIN__ checks
    + Remove cruft from win32config.h
    + crypto.c: Silence a compiler warning on Windows (Chun-wei Fan)
  * Build system
    + Add missing compile definition for static builds to CMake
    + Avoid obsolescent `test -a` constructs (David Seifert)
    + Only link libxml2 statically in purely static build
    + Set AC_CONFIG_MACRO_DIR
    + Allow AM_MAINTAINER_MODE to be disabled
    + Streamline and fix documentation installation
    + Don't try to recreate COPYING symlink
    + Remove special configuration for certain maintainers
    + configure.ac: produce tar.xz only (GNOME policy) (David Seifert)
    + Detect libm using libtool's macros (David Seifert)

OBS-URL: https://build.opensuse.org/request/show/997692
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libxslt?expand=0&rev=94
2022-08-18 08:45:47 +00:00

47 lines
1000 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,14 @@
#include <math.h>
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
#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;