Browse code

ThreadTimeout fix

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

Tomasz Kojm authored on 2004/01/15 23:34:33
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Thu Jan 15 15:31:13 CET 2004 (tk)
2
+---------------------------------
3
+  * clamd: "ThreadTimeout 0" now properly disables the limit (thanks to
4
+	   Trog <trog*uncon.org>)
5
+
1 6
 Wed Jan 14 18:03:17 GMT 2004 (njh)
2 7
 ----------------------------------
3 8
   * libclamav: added definition of binhexBegin
... ...
@@ -59,8 +59,10 @@ int procscan(const char *name, const struct cl_node *root, const struct cl_limit
59 59
 	case 0:
60 60
 	    if((cpt = cfgopt(copt, "ThreadTimeout")))
61 61
 	        alarm(cpt->numarg);
62
+/* 0 should disable the limit
62 63
 	    else
63 64
 	        alarm(CL_DEFAULT_SCANTIMEOUT);
65
+*/
64 66
 
65 67
 	    if(!name)
66 68
 		scanstream(odesc, NULL, root, limits, options, copt);
... ...
@@ -179,7 +179,7 @@ void *threadwatcher(void *arg)
179 179
 	    i = 0;
180 180
 
181 181
 	/* check time */
182
-        if(ths[i].active) /* races are harmless here (timeout is re-set) */
182
+        if(timeout && ths[i].active) /* races are harmless here (timeout is re-set) */
183 183
 	    if(time(NULL) - ths[i].start > timeout) {
184 184
 		pthread_cancel(ths[i].id);
185 185
 		mdprintf(ths[i].desc, "Session(%d): Time out ERROR\n", i);
... ...
@@ -290,7 +290,7 @@ void *threadwatcher(void *arg)
290 290
 		need_wait = 0;
291 291
 		for(j = 0; j < threads; j++)
292 292
 		    if(ths[j].active) {
293
-			if(time(NULL) - ths[j].start > timeout) {
293
+			if(timeout && (time(NULL) - ths[j].start > timeout)) {
294 294
 			    do_loop = 1;
295 295
 			    break;
296 296
 			} else need_wait = 1;