Kristyna Streitova
317be88447
Rename package OBS-URL: https://build.opensuse.org/request/show/505665 OBS-URL: https://build.opensuse.org/package/show/Apache/apr?expand=0&rev=1
26 lines
643 B
Diff
26 lines
643 B
Diff
--- apr-1.5.1.orig/misc/unix/rand.c
|
|
+++ apr-1.5.1/misc/unix/rand.c
|
|
@@ -43,6 +43,9 @@
|
|
#include <sys/uuid.h>
|
|
#endif
|
|
|
|
+#include <sys/syscall.h>
|
|
+#include <linux/random.h>
|
|
+
|
|
#ifndef SHUT_RDWR
|
|
#define SHUT_RDWR 2
|
|
#endif
|
|
@@ -89,6 +92,12 @@ APR_DECLARE(apr_status_t) apr_generate_r
|
|
{
|
|
#ifdef DEV_RANDOM
|
|
|
|
+#ifdef SYS_getrandom
|
|
+ int r = TEMP_FAILURE_RETRY(syscall(SYS_getrandom, buf, length, GRND_NONBLOCK));
|
|
+ if(r != -1 && r == length)
|
|
+ return APR_SUCCESS;
|
|
+ /* If this fails for whatever reason..fallback to the old ways.. */
|
|
+#endif
|
|
int fd = -1;
|
|
|
|
/* On BSD/OS 4.1, /dev/random gives out 8 bytes at a time, then
|