Browse code

add missing mutex sync for progexit (bb#461)

git-svn: trunk@3610

Tomasz Kojm authored on 2008/02/12 00:00:37
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Feb 11 15:46:39 CET 2008 (tk)
2
+---------------------------------
3
+  * libclamav/server-th.c: add missing mutex sync for progexit (bb#461)
4
+
1 5
 Mon Feb 11 12:21:19 CET 2008 (tk)
2 6
 ---------------------------------
3 7
   * clamscan: match_regex: make sure --exclude/include patterns with
... ...
@@ -551,9 +551,12 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_engine *engine, unsigne
551 551
 	if (new_sd != -1)
552 552
 	    new_sd = accept(socketd, NULL, NULL);
553 553
 	if((new_sd == -1) && (errno != EINTR)) {
554
+	    pthread_mutex_lock(&exit_mutex);
554 555
 	    if(progexit) {
556
+		pthread_mutex_unlock(&exit_mutex);
555 557
 	    	break;
556 558
 	    }
559
+	    pthread_mutex_unlock(&exit_mutex);
557 560
 	    /* very bad - need to exit or restart */
558 561
 #ifdef HAVE_STRERROR_R
559 562
 	    strerror_r(errno, buff, BUFFSIZE);