#endif
/*
- * Initialize any event loops just enough so module instantiations can
- * add fd/event to them, but do not start them yet.
- */
- if (!radius_event_init(autofree)) exit(EXIT_FAILURE);
-
- /*
* Read the configuration files, BEFORE doing anything else.
*/
if (main_config_init() < 0) exit(EXIT_FAILURE);
#endif
/*
- * Load the modules
- */
- if (modules_init(main_config.config) < 0) exit(EXIT_FAILURE);
-
- /*
* Set the panic action (if required)
*/
if (main_config.panic_action &&
radius_pid = getpid();
/*
+ * Initialize any event loops just enough so module instantiations can
+ * add fd/event to them, but do not start them yet.
+ *
+ * This has to be done post-fork in case we're using kqueue, where the
+ * queue isn't inherited by the child process.
+ */
+ if (!radius_event_init(autofree)) exit(EXIT_FAILURE);
+
+ /*
+ * Load the modules
+ */
+ if (modules_init(main_config.config) < 0) exit(EXIT_FAILURE);
+
+ /*
* Redirect stderr/stdout as appropriate.
*/
if (radlog_init(&default_log, main_config.daemonize) < 0) {