Browse code

Yesterday's new code broke --leave-temps

git-svn: trunk@3194

Nigel Horne authored on 2007/08/30 17:59:48
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Aug 30 09:05:45 BST 2007 (njh)
2
+----------------------------------
3
+  * libclamav/blob.c:	Yesterday's new code broke --leave-temps
4
+
1 5
 Wed Aug 29 18:27:55 BST 2007 (njh)
2 6
 ----------------------------------
3 7
   * libclamav:	mbox optimisation to reduce the lifetime of temporary files
... ...
@@ -70,6 +70,7 @@ static	char	const	rcsid[] = "$Id: blob.c,v 1.64 2007/02/12 22:25:14 njh Exp $";
70 70
 				 * large sized files
71 71
 				 */
72 72
 
73
+extern	short	cli_leavetemps_flag;
73 74
 static	const	char	*blobGetFilename(const blob *b);
74 75
 
75 76
 blob *
... ...
@@ -379,6 +380,12 @@ fileblobCreate(void)
379 379
 int
380 380
 fileblobScanAndDestroy(fileblob *fb)
381 381
 {
382
+	if(cli_leavetemps_flag) {
383
+		/* Can't remove the file, the caller must scan */
384
+		fileblobDestroy(fb);
385
+		return CL_CLEAN;
386
+	}
387
+		
382 388
 	switch(fileblobScan(fb)) {
383 389
 		case CL_VIRUS:
384 390
 			fileblobDestructiveDestroy(fb);
... ...
@@ -650,7 +657,7 @@ fileblobScan(const fileblob *fb)
650 650
 	}
651 651
 	/* cli_scanfile is static :-( */
652 652
 	/*if(cli_scanfile(fb->fullname, fb->ctx) == CL_VIRUS) {
653
-		printf("%s is infected\n", fb->fullname);
653
+		cli_dbgmsg("%s is infected\n", fb->fullname);
654 654
 		return CL_VIRUS;
655 655
 	}*/
656 656
 
... ...
@@ -662,8 +669,6 @@ fileblobScan(const fileblob *fb)
662 662
 	}
663 663
 	cli_dbgmsg("%s is clean\n", fb->fullname);
664 664
 	return CL_BREAK;
665
-
666
-	/*return cli_scanfile(fb->fullname, fb->ctx);*/
667 665
 }
668 666
 
669 667
 /*