Browse code

Fix handling of 2nd and subsequent SIGUSR2 calls

git-svn: trunk@3445

Nigel Horne authored on 2007/12/20 21:48:09
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Dec 20 12:09:22 GMT 2007 (njh)
2
+----------------------------------
3
+  * clamav-milter:	Fix handling of 2nd and subsequent SIGUSR2 calls
4
+
1 5
 Wed Dec 19 22:11:17 CET 2007 (tk)
2 6
 ---------------------------------
3 7
   * freshclam, libclamav: drop support for .inc directories and instead use
... ...
@@ -14,11 +18,11 @@ Wed Dec 19 16:22:24 CET 2007 (tk)
14 14
 Wed Dec 19 10:17:02 GMT 2007 (trog)
15 15
 -----------------------------------
16 16
   * libclamav/chmunpack.[ch], scanners.c: re-structure CHM unpacker. Uses no
17
-  			dynamic memory when mmap() available.
17
+			dynamic memory when mmap() available.
18 18
 
19 19
 Tue Dec 18 19:55:13 CET 2007 (acab)
20 20
 -----------------------------------
21
-  * libclamav/unzip.c: Fix mmap leaks in unzip 
21
+  * libclamav/unzip.c: Fix mmap leaks in unzip
22 22
 
23 23
 Tue Dec 18 19:43:04 CET 2007 (tk)
24 24
 ---------------------------------
... ...
@@ -33,7 +33,7 @@
33 33
  */
34 34
 static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.312 2007/02/12 22:24:21 njh Exp $";
35 35
 
36
-#define	CM_VERSION	"devel-20071213"
36
+#define	CM_VERSION	"devel-20071220"
37 37
 
38 38
 #if HAVE_CONFIG_H
39 39
 #include "clamav-config.h"
... ...
@@ -1199,7 +1199,7 @@ main(int argc, char **argv)
1199 1199
 			if(setuid(user->pw_uid) < 0)
1200 1200
 				perror(cpt->strarg);
1201 1201
 			else
1202
-				cli_dbgmsg(_("Running as user %s (UID %d, GID %d)\n"),
1202
+				logg(_("Running as user %s (UID %d, GID %d)\n"),
1203 1203
 					cpt->strarg, (int)user->pw_uid,
1204 1204
 					(int)user->pw_gid);
1205 1205
 
... ...
@@ -1559,7 +1559,7 @@ main(int argc, char **argv)
1559 1559
 			free(hostname);
1560 1560
 		}
1561 1561
 
1562
-		cli_dbgmsg("numServers: %d\n", numServers);
1562
+		logg("numServers: %d\n", numServers);
1563 1563
 
1564 1564
 		serverIPs = (in_addr_t *)cli_malloc(numServers * sizeof(in_addr_t));
1565 1565
 		if(serverIPs == NULL)
... ...
@@ -1648,7 +1648,7 @@ main(int argc, char **argv)
1648 1648
 			if(pingServer(i))
1649 1649
 				activeServers++;
1650 1650
 			else {
1651
-				cli_warnmsg(_("Can't talk to clamd server %s on port %d\n"),
1651
+				logg(_("^Can't talk to clamd server %s on port %d\n"),
1652 1652
 					hostname, tcpSocket);
1653 1653
 				if(serverIPs[i] == htonl(INADDR_LOOPBACK)) {
1654 1654
 					if(cfgopt(copt, "TCPAddr")->enabled)
... ...
@@ -4646,7 +4646,7 @@ connect2clamd(struct privdata *privdata)
4646 4646
 		 */
4647 4647
 		if((privdata->dataSocket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
4648 4648
 			perror("socket");
4649
-			logg(_("!failed to create TCPSocket to talk to clamd"));
4649
+			logg(_("!failed to create TCPSocket to talk to clamd\n"));
4650 4650
 			return 0;
4651 4651
 		}
4652 4652
 
... ...
@@ -4657,9 +4657,9 @@ connect2clamd(struct privdata *privdata)
4657 4657
 		if(nbytes <= 0) {
4658 4658
 			if(nbytes < 0) {
4659 4659
 				perror("recv");
4660
-				logg(_("!recv failed from clamd getting PORT"));
4660
+				logg(_("!recv failed from clamd getting PORT\n"));
4661 4661
 			} else
4662
-				logg(_("!EOF from clamd getting PORT"));
4662
+				logg(_("!EOF from clamd getting PORT\n"));
4663 4663
 
4664 4664
 			pthread_mutex_lock(&sstatus_mutex);
4665 4665
 			session->status = CMDSOCKET_DOWN;
... ...
@@ -4670,9 +4670,9 @@ connect2clamd(struct privdata *privdata)
4670 4670
 		if(nbytes <= 0) {
4671 4671
 			if(nbytes < 0) {
4672 4672
 				perror("recv");
4673
-				logg(_("!recv failed from clamd getting PORT"));
4673
+				logg(_("!recv failed from clamd getting PORT\n"));
4674 4674
 			} else
4675
-				logg(_("!EOF from clamd getting PORT"));
4675
+				logg(_("!EOF from clamd getting PORT\n"));
4676 4676
 
4677 4677
 			return 0;
4678 4678
 		}
... ...
@@ -4683,7 +4683,7 @@ connect2clamd(struct privdata *privdata)
4683 4683
 			cli_dbgmsg("Received: %s", buf);
4684 4684
 #endif
4685 4685
 		if(sscanf(buf, "PORT %hu\n", &p) != 1) {
4686
-			logg(_("!Expected port information from clamd, got '%s'"),
4686
+			logg(_("!Expected port information from clamd, got '%s'\n"),
4687 4687
 				buf);
4688 4688
 #ifdef	SESSION
4689 4689
 			session->status = CMDSOCKET_DOWN;
... ...
@@ -5865,7 +5865,7 @@ loadDatabase(void)
5865 5865
 		cl_free(oldroot);
5866 5866
 		logg("#Database correctly reloaded (%u viruses)\n", signatures);
5867 5867
 	} else
5868
-		cli_dbgmsg("Database loaded\n");
5868
+		logg("*Database loaded\n");
5869 5869
 
5870 5870
 	return cl_statinidir(dbdir, &dbstat);
5871 5871
 }
... ...
@@ -5901,7 +5901,7 @@ sighup(int sig)
5901 5901
 static void
5902 5902
 sigusr2(int sig)
5903 5903
 {
5904
-	signal(SIGUSR2, sighup);
5904
+	signal(SIGUSR2, sigusr2);
5905 5905
 
5906 5906
 	logg("^SIGUSR2 caught: scheduling database reload\n");
5907 5907
 	reload++;
... ...
@@ -6745,11 +6745,11 @@ increment_connexions(void)
6745 6745
 		}
6746 6746
 		n_children++;
6747 6747
 
6748
-		cli_dbgmsg(">n_children = %d\n", n_children);
6748
+		logg("*>n_children = %d\n", n_children);
6749 6749
 		pthread_mutex_unlock(&n_children_mutex);
6750 6750
 
6751 6751
 		if(child_timeout && (rc == ETIMEDOUT))
6752
-			logg(_("*Timeout waiting for a child to die\n"));
6752
+			logg(_("Timeout waiting for a child to die\n"));
6753 6753
 	}
6754 6754
 
6755 6755
 	return 1;
... ...
@@ -6760,22 +6760,22 @@ decrement_connexions(void)
6760 6760
 {
6761 6761
 	if(max_children > 0) {
6762 6762
 		pthread_mutex_lock(&n_children_mutex);
6763
-		cli_dbgmsg("decrement_connexions: n_children = %d\n", n_children);
6763
+		logg("*decrement_connexions: n_children = %d\n", n_children);
6764 6764
 		/*
6765 6765
 		 * Deliberately errs on the side of broadcasting too many times
6766 6766
 		 */
6767 6767
 		if(n_children > 0)
6768 6768
 			if(--n_children == 0) {
6769
-				cli_dbgmsg("%s is idle\n", progname);
6769
+				logg("*%s is idle\n", progname);
6770 6770
 				if(pthread_cond_broadcast(&watchdog_cond) < 0)
6771 6771
 					perror("pthread_cond_broadcast");
6772 6772
 			}
6773 6773
 #ifdef	CL_DEBUG
6774
-		cli_dbgmsg("pthread_cond_broadcast\n");
6774
+		logg("*pthread_cond_broadcast\n");
6775 6775
 #endif
6776 6776
 		if(pthread_cond_broadcast(&n_children_cond) < 0)
6777 6777
 			perror("pthread_cond_broadcast");
6778
-		cli_dbgmsg("<n_children = %d\n", n_children);
6778
+		logg("*<n_children = %d\n", n_children);
6779 6779
 		pthread_mutex_unlock(&n_children_mutex);
6780 6780
 	}
6781 6781
 }