From ffc30c5b8d4c0324e25cdfd51f77b89f99a28a90 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 8 Nov 2020 12:57:54 +0000 Subject: [PATCH] getrandom support for DragonFlyBSD too. supported since the 5.7.x release, actually 5.8.x is the stable one. --- ext/standard/random.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/standard/random.c b/ext/standard/random.c index 81a2b3dc326..92a9d69b3c3 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -29,9 +29,9 @@ #ifdef __linux__ # include #endif -#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) # include -# if __FreeBSD__ && __FreeBSD_version > 1200000 +# if (__FreeBSD__ && __FreeBSD_version > 1200000) || (__DragonFly__ && __DragonFly_version >= 500700) # include # endif #endif @@ -99,8 +99,8 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, bool should_throw) #else size_t read_bytes = 0; ssize_t n; -#if (defined(__linux__) && defined(SYS_getrandom)) || (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) - /* Linux getrandom(2) syscall or FreeBSD getrandom(2) function*/ +#if (defined(__linux__) && defined(SYS_getrandom)) || (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) + /* Linux getrandom(2) syscall or FreeBSD/DragonFlyBSD getrandom(2) function*/ /* Keep reading until we get enough entropy */ while (read_bytes < size) { /* Below, (bytes + read_bytes) is pointer arithmetic.