git-svn: trunk@3851
aCaB authored on 2008/05/12 23:49:25... | ... |
@@ -65,10 +65,10 @@ |
65 | 65 |
#endif |
66 | 66 |
|
67 | 67 |
int progexit = 0; |
68 |
-pthread_mutex_t exit_mutex; |
|
68 |
+pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER; |
|
69 | 69 |
int reload = 0; |
70 | 70 |
time_t reloaded_time = 0; |
71 |
-pthread_mutex_t reload_mutex; |
|
71 |
+pthread_mutex_t reload_mutex = PTHREAD_MUTEX_INITIALIZER; |
|
72 | 72 |
int sighup = 0; |
73 | 73 |
static struct cl_stat *dbstat = NULL; |
74 | 74 |
|
... | ... |
@@ -306,7 +306,9 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_engine *engine, unsigne |
306 | 306 |
if((fd = fopen(cpt->strarg, "w")) == NULL) { |
307 | 307 |
logg("!Can't save PID in file %s\n", cpt->strarg); |
308 | 308 |
} else { |
309 |
- fprintf(fd, "%u", (unsigned int) mainpid); |
|
309 |
+ if (fprintf(fd, "%u", (unsigned int) mainpid)<0) { |
|
310 |
+ logg("!Can't save PID in file %s\n", cpt->strarg); |
|
311 |
+ } |
|
310 | 312 |
fclose(fd); |
311 | 313 |
} |
312 | 314 |
umask(old_umask); |
... | ... |
@@ -513,9 +515,6 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_engine *engine, unsigne |
513 | 513 |
sigaction(SIGUSR2, &sigact, NULL); |
514 | 514 |
#endif |
515 | 515 |
|
516 |
- pthread_mutex_init(&exit_mutex, NULL); |
|
517 |
- pthread_mutex_init(&reload_mutex, NULL); |
|
518 |
- |
|
519 | 516 |
idletimeout = cfgopt(copt, "IdleTimeout")->numarg; |
520 | 517 |
|
521 | 518 |
if((thr_pool=thrmgr_new(max_threads, idletimeout, scanner_thread)) == NULL) { |