]> source.dussan.org Git - rspamd.git/commitdiff
Treat PRNG init errors as fatal
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Nov 2015 11:19:18 +0000 (11:19 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 9 Nov 2015 11:19:18 +0000 (11:19 +0000)
src/libserver/worker_util.c

index 5d8b8c608e0623ebe7cfd9ef50b9db71ae397879..f404a329588a2f6f8ee8b98561457b709e405ed5 100644 (file)
@@ -439,6 +439,7 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
                guint index)
 {
        struct rspamd_worker *cur;
+       gint rc;
        /* Starting worker process */
        cur = (struct rspamd_worker *) g_malloc0 (sizeof (struct rspamd_worker));
 
@@ -462,7 +463,12 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
                rspamd_log_update_pid (cf->type, rspamd_main->logger);
                /* Lock statfile pool if possible XXX */
                /* Init PRNG after fork */
-               ottery_init (NULL);
+               rc = ottery_init (NULL);
+               if (rc != OTTERY_ERR_NONE) {
+                       msg_err_main ("cannot initialize PRNG: %d", rc);
+                       g_assert (0);
+               }
+
                g_random_set_seed (ottery_rand_uint32 ());
                /* Drop privilleges */
                rspamd_worker_drop_priv (rspamd_main);