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

+4 -3
View File
@@ -310,7 +310,7 @@ static int h_log(int argc, unsigned char ** argv){
}
#endif
else {
FILE *fp, *fp1;
FILE *fp;
if(argc > 2) {
conf.logtype = getrotate(*argv[2]);
}
@@ -323,9 +323,10 @@ static int h_log(int argc, unsigned char ** argv){
return 1;
}
else {
fp1 = conf.stdlog;
pthread_mutex_lock(&log_mutex);
if(conf.stdlog)fclose(conf.stdlog);
conf.stdlog = fp;
if(fp1) fclose(fp1);
pthread_mutex_unlock(&log_mutex);
#ifdef _WINCE
freopen(tmpbuf, "w", stdout);
freopen(tmpbuf, "w", stderr);