Browse code

--timeout didnt always work

git-svn: trunk@1689

Nigel Horne authored on 2005/08/12 05:16:54
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Aug 11 21:15:26 BST 2005 (njh)
2
+----------------------------------
3
+  * clamav-milter:	--timeout wasn't always being honoured
4
+
1 5
 Fri Aug  5 02:48:47 CEST 2005 (tk)
2 6
 ----------------------------------
3 7
   * libclamav: merge PESpin unpacker from aCaB
... ...
@@ -22,7 +22,7 @@
22 22
  *
23 23
  * For installation instructions see the file INSTALL that came with this file
24 24
  */
25
-static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.216 2005/08/11 11:20:45 nigelhorne Exp $";
25
+static	char	const	rcsid[] = "$Id: clamav-milter.c,v 1.217 2005/08/11 20:13:38 nigelhorne Exp $";
26 26
 
27 27
 #define	CM_VERSION	"devel-110805"
28 28
 
... ...
@@ -2232,21 +2232,20 @@ clamfi_envfrom(SMFICTX *ctx, char **argv)
2232 2232
 			 * Patch from Damian Menscher <menscher@uiuc.edu> to
2233 2233
 			 * ensure it wakes up when a child goes away
2234 2234
 			 */
2235
-			if(child_timeout) {
2236
-				struct timeval now;
2237
-				struct timezone tz;
2238
-
2239
-				gettimeofday(&now, &tz);
2240
-				timeout.tv_sec = now.tv_sec + child_timeout;
2241
-				timeout.tv_nsec = 0;
2242
-			}
2243
-
2244 2235
 			do
2245 2236
 				if(child_timeout == 0) {
2246 2237
 					pthread_cond_wait(&n_children_cond, &n_children_mutex);
2247 2238
 					rc = 0;
2248
-				} else
2239
+				} else {
2240
+					struct timeval now;
2241
+					struct timezone tz;
2242
+
2243
+					gettimeofday(&now, &tz);
2244
+					timeout.tv_sec = now.tv_sec + child_timeout;
2245
+					timeout.tv_nsec = 0;
2246
+
2249 2247
 					rc = pthread_cond_timedwait(&n_children_cond, &n_children_mutex, &timeout);
2248
+				}
2250 2249
 			while((n_children >= max_children) && (rc != ETIMEDOUT));
2251 2250
 		}
2252 2251
 		n_children++;