[Mimedefang] [PATCH] to fix the issues with FreeBSD and clamd0.90

Martin Blapp mb at imp.ch
Sat Mar 10 08:11:41 EST 2007


And here the race window is even more narrowed down ...

--- libclamav/mbox.c.orig	Tue Feb 13 14:06:57 2007
+++ libclamav/mbox.c	Sat Mar 10 14:09:09 2007
@@ -413,6 +413,7 @@

  #ifdef	CL_THREAD_SAFE
  static	pthread_mutex_t	tables_mutex = PTHREAD_MUTEX_INITIALIZER;
+static  pthread_mutex_t body_mutex = PTHREAD_MUTEX_INITIALIZER;
  #endif

  #ifndef	O_BINARY
@@ -1494,6 +1495,7 @@
  		/*
  		 * Write out the last entry in the mailbox
  		 */
+		pthread_mutex_lock(&body_mutex);
  		if((retcode == CL_SUCCESS) && messageGetBody(body)) {
  			messageSetCTX(body, ctx);
  			switch(parseEmailBody(body, NULL, &mctx, 0)) {
@@ -1505,6 +1507,7 @@
  					break;
  			}
  		}
+		pthread_mutex_unlock(&body_mutex);

  		/*
  		 * Tidy up and quit

Martin Blapp, <mb at imp.ch> <mbr at FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr at freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------



More information about the MIMEDefang mailing list