diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-09-11 22:03:57 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-09-11 22:04:21 +0100 |
commit | 7d7b3200affdeefabbf8eb2066ec579a46a91db5 (patch) | |
tree | 994ed3fd765fc7f97ed1a4e19d9db48a36c7f102 /src | |
parent | dee81173939fdb611912c26a63d1168e87c29f0a (diff) | |
download | rspamd-7d7b3200affdeefabbf8eb2066ec579a46a91db5.tar.gz rspamd-7d7b3200affdeefabbf8eb2066ec579a46a91db5.zip |
[Minor] Explicitly reinit libevent PRNG on fork
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/worker_util.c | 15 |
1 files changed, 10 insertions, 5 deletions
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 */ |