Browse code

Don't start watchdog monitor in localSocket mode

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1076 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/11/09 05:37:56
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Nov  8 20:37:41 GMT 2004 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Don't start the clamd watchdog when in localSocket mode
4
+
1 5
 Mon Nov  8 16:29:13 GMT 2004 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/message.c:	Fix crash with incorrectly encoded uuencode
... ...
@@ -554,6 +554,7 @@ Changes
554 554
 		When changing a subject, keep the original subject in
555 555
 			X-Original-Subject
556 556
 0.80p	4/11/04	SESSION: Fix bug causing crash when using LocalSocket mode
557
+0.80q	8/11/04	SESSION: Ensure watchdog only started in TCPSocket mode
557 558
 
558 559
 INTERNATIONALISATION
559 560
 
... ...
@@ -26,6 +26,9 @@
26 26
  *
27 27
  * Change History:
28 28
  * $Log: clamav-milter.c,v $
29
+ * Revision 1.150  2004/11/08 20:35:12  nigelhorne
30
+ * Don't start watchdog monitor in localSocket mode
31
+ *
29 32
  * Revision 1.149  2004/11/04 14:20:37  nigelhorne
30 33
  * Fix typo in error message
31 34
  *
... ...
@@ -458,9 +461,9 @@
458 458
  * Revision 1.6  2003/09/28 16:37:23  nigelhorne
459 459
  * Added -f flag use MaxThreads if --max-children not set
460 460
  */
461
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.149 2004/11/04 14:20:37 nigelhorne Exp $";
461
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.150 2004/11/08 20:35:12 nigelhorne Exp $";
462 462
 
463
-#define	CM_VERSION	"0.80p"
463
+#define	CM_VERSION	"0.80q"
464 464
 
465 465
 /*#define	CONFDIR	"/usr/local/etc"*/
466 466
 
... ...
@@ -1361,6 +1364,8 @@ main(int argc, char **argv)
1361 1361
 				syslog(LOG_ERR, _("Can't create a clamd session"));
1362 1362
 			return EX_UNAVAILABLE;
1363 1363
 		}
1364
+		cmdSocketsStatus = (int *)cli_malloc(sizeof(int));
1365
+		cmdSocketsStatus[0] = CMDSOCKET_FREE;
1364 1366
 #endif
1365 1367
 		/*
1366 1368
 		 * FIXME: Allow connection to remote servers by TCP/IP whilst
... ...
@@ -1533,7 +1538,9 @@ main(int argc, char **argv)
1533 1533
 	atexit(quit);
1534 1534
 
1535 1535
 #ifdef	SESSION
1536
-	pthread_create(&tid, NULL, watchdog, NULL);
1536
+	/* FIXME: add localSocket support to watchdog */
1537
+	if(!localSocket)
1538
+		pthread_create(&tid, NULL, watchdog, NULL);
1537 1539
 #endif
1538 1540
 
1539 1541
 	if((cpt = cfgopt(copt, "PidFile")) != NULL)
... ...
@@ -1629,7 +1636,7 @@ main(int argc, char **argv)
1629 1629
 /*
1630 1630
  * Use the SESSION command of clamd.
1631 1631
  * Returns -1 for terminal failure, 0 for OK, 1 for nonterminal failure
1632
- * The caller must take care of locking the cmdSocketStatus array
1632
+ * The caller must take care of locking the cmdSocketsStatus array
1633 1633
  */
1634 1634
 static int
1635 1635
 createSession(int session)
... ...
@@ -4020,6 +4027,8 @@ clamdIsDown(void)
4020 4020
  *
4021 4021
  * It is woken up when the milter goes idle, when there are no free servers
4022 4022
  * available and once every readTimeout-1 seconds
4023
+ *
4024
+ * TODO: localSocket support
4023 4025
  */
4024 4026
 static void *
4025 4027
 watchdog(void *a)
... ...
@@ -4227,7 +4236,7 @@ quit(void)
4227 4227
 		syslog(LOG_INFO, _("Stopping %s"), clamav_version);
4228 4228
 
4229 4229
 	pthread_mutex_lock(&sstatus_mutex);
4230
-	for(i = 0; i < max_children; i++) {
4230
+	for(i = 0; i < (localSocket != NULL) ? 1 : max_children; i++) {
4231 4231
 		const int sock = cmdSockets[i];
4232 4232
 
4233 4233
 		/*