1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Fix: Reorder logging initialization to prevent race

Without this, the logging on the stats thread would race with the log
initialization on the main thread.
This commit is contained in:
Marvin Scholz 2020-04-19 03:09:49 +02:00
parent d2b137a8ad
commit 25f54db863

View File

@ -634,6 +634,12 @@ int main(int argc, char **argv)
_ch_root_uid_setup(); /* Change user id and root if requested/possible */
#endif
if (!_start_logging()) {
_fatal_error("FATAL: Could not start logging");
shutdown_subsystems();
return 1;
}
stats_initialize(); /* We have to do this later on because of threading */
fserve_initialize(); /* This too */
@ -652,12 +658,6 @@ int main(int argc, char **argv)
/* setup default signal handlers */
sighandler_initialize();
if (!_start_logging()) {
_fatal_error("FATAL: Could not start logging");
shutdown_subsystems();
return 1;
}
ICECAST_LOG_INFO("%s server started", ICECAST_VERSION_STRING);
ICECAST_LOG_INFO("Server's PID is %lli", (long long int)getpid());
__log_system_name();