aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.h.in5
-rw-r--r--src/libserver/worker_util.c15
2 files changed, 15 insertions, 5 deletions
diff --git a/config.h.in b/config.h.in
index 8ebb2e56d..90edc1132 100644
--- a/config.h.in
+++ b/config.h.in
@@ -39,6 +39,7 @@
#cmakedefine HAVE_INTTYPES_H 1
#cmakedefine HAVE_IPV6_V6ONLY 1
#cmakedefine HAVE_LIBAIO_H 1
+#cmakedefine HAVE_LIBEVENT2 1
#cmakedefine HAVE_LIBGEN_H 1
#cmakedefine HAVE_LIBUTIL_H 1
#cmakedefine HAVE_LOCALE_H 1
@@ -136,6 +137,10 @@
#cmakedefine DISABLE_PTHREAD_MUTEX 1
+#ifdef HAVE_LIBEVENT2
+#define HAVE_EVUTIL_RNG_INIT 1
+#endif
+
/* Detect endiannes */
#ifdef HAVE_ENDIAN_H
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 4043f79a3..80fec531c 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -544,19 +544,24 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
case 0:
/* Update pid for logging */
rspamd_log_update_pid (cf->type, rspamd_main->logger);
- /* Remove the inherited event base */
- event_reinit (rspamd_main->ev_base);
- event_base_free (rspamd_main->ev_base);
- /* Lock statfile pool if possible XXX */
+
/* Init PRNG after fork */
rc = ottery_init (rspamd_main->cfg->libs_ctx->ottery_cfg);
- rspamd_random_seed_fast ();
if (rc != OTTERY_ERR_NONE) {
msg_err_main ("cannot initialize PRNG: %d", rc);
g_assert (0);
}
+ rspamd_random_seed_fast ();
g_random_set_seed (ottery_rand_uint32 ());
+#ifdef HAVE_EVUTIL_RNG_INIT
+ evutil_secure_rng_init ();
+#endif
+
+ /* Remove the inherited event base */
+ event_reinit (rspamd_main->ev_base);
+ event_base_free (rspamd_main->ev_base);
+
/* Drop privilleges */
rspamd_worker_drop_priv (rspamd_main);
/* Set limits */