Otherwise, the call to daemon() could close filedescriptors in use by libevent
itself; for example if it uses kqueue or epoll instead of a select() or poll()
backend.
openlogger("tinc", use_logfile?LOGMODE_FILE:LOGMODE_STDERR);
- if(!event_init()) {
- logger(DEBUG_ALWAYS, LOG_ERR, "Error initializing libevent!");
- return 1;
- }
-
g_argv = argv;
if(getenv("LISTEN_PID") && atoi(getenv("LISTEN_PID")) == getpid())
}
#endif
+ if(!event_init()) {
+ logger(DEBUG_ALWAYS, LOG_ERR, "Error initializing libevent!");
+ return 1;
+ }
+
/* Setup sockets and open device. */
if(!setup_network())