Race conditions fixed on config reload

Race conditions on logging and name resolution
This commit is contained in:
z3APA3A committed 2015-12-04 00:59:52 +03:00
1 parent 1220c504bd
commit bd37ffa2f7
7 files changed
+41 -21

No files matched your search

+7 -3
View File
@@ -270,12 +270,13 @@ void cyclestep(void){
}
if(conf.logname) {
if(timechanged(conf.logtime, conf.time, conf.logtype)) {
FILE *fp, *fp1;
FILE *fp;
fp = fopen((char *)dologname (tmpbuf, conf.logname, NULL, conf.logtype, conf.time), "a");
if (fp) {
fp1 = conf.stdlog;
pthread_mutex_lock(&log_mutex);
fclose(conf.stdlog);
conf.stdlog = fp;
if(fp1) fclose(fp1);
pthread_mutex_unlock(&log_mutex);
}
fseek(stdout, 0L, SEEK_END);
usleep(SLEEPTIME);
@@ -510,6 +511,9 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
return 1;
}
pthread_mutex_init(&log_mutex, NULL);
logmutexinit = 1;
pthread_mutex_init(&config_mutex, NULL);
pthread_mutex_init(&bandlim_mutex, NULL);
pthread_mutex_init(&hash_mutex, NULL);