From 266f43af7798befa3d27bfabaa9ae699259c3924 Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <a3at.mail@gmail.com>
Date: Mon, 27 Mar 2017 15:50:23 +0300
Subject: [PATCH] Fix arc4random_addrandom() detecting and fallback
 (regression)

But this is kind of hot-fix, we definitelly need more sane arc4random
compat layer.

Fixes: #488
Introduced-in: 6541168 ("Detect arch4random_addrandom() existence")
---
 event-config.h.cmake  | 3 +++
 include/event2/util.h | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/event-config.h.cmake b/event-config.h.cmake
index b7f0be57c..5c233a3d9 100644
--- a/event-config.h.cmake
+++ b/event-config.h.cmake
@@ -53,6 +53,9 @@
 /* Define to 1 if you have the `arc4random_buf' function. */
 #cmakedefine EVENT__HAVE_ARC4RANDOM_BUF 1
 
+/* Define to 1 if you have the `arc4random_addrandom' function. */
+#cmakedefine EVENT__HAVE_ARC4RANDOM_ADDRANDOM 1
+
 /* Define if clock_gettime is available in libc */
 #cmakedefine EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1
 
diff --git a/include/event2/util.h b/include/event2/util.h
index c4af2bd60..ca4048944 100644
--- a/include/event2/util.h
+++ b/include/event2/util.h
@@ -842,7 +842,7 @@ int evutil_secure_rng_init(void);
 EVENT2_EXPORT_SYMBOL
 int evutil_secure_rng_set_urandom_device_file(char *fname);
 
-#ifdef EVENT__HAVE_ARC4RANDOM_ADDRANDOM
+#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM)
 /** Seed the random number generator with extra random bytes.
 
     You should almost never need to call this function; it should be
