Browse code

Fix when to delete the script file

git-svn: trunk@2356

Nigel Horne authored on 2006/10/09 18:10:26
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Oct  9 10:09:27 BST 2006 (njh)
2
+----------------------------------
3
+  * libclamav/js.c:	Was trying to delete the script file even when it
4
+		hadn't been created
5
+
1 6
 Sun Oct  8 21:55:46 BST 2006 (njh)
2 7
 ----------------------------------
3 8
   * clamav-milter/INSTALL:	Documented integration with postfix, thanks
... ...
@@ -19,7 +19,7 @@
19 19
  * Save the JavaScript embedded in an HTML file, then run the script, saving
20 20
  * the output in a file that is to be scanned, then remove the script file
21 21
  */
22
-static	char	const	rcsid[] = "$Id: js.c,v 1.5 2006/10/08 13:56:51 njh Exp $";
22
+static	char	const	rcsid[] = "$Id: js.c,v 1.6 2006/10/09 09:08:53 njh Exp $";
23 23
 
24 24
 #if HAVE_CONFIG_H
25 25
 #include "clamav-config.h"
... ...
@@ -69,7 +69,6 @@ cli_scanjs(const char *dir, int desc)
69 69
 	int done_header, rc;
70 70
 	FILE *fout;
71 71
 	char script_filename[NAME_MAX + 1];
72
-	extern short cli_leavetemps_flag;
73 72
 
74 73
 	cli_dbgmsg("in cli_scanjs(%s)\n", dir);
75 74
 
... ...
@@ -205,6 +204,7 @@ cli_scanjs(const char *dir, int desc)
205 205
 	else if(fout == NULL)
206 206
 		cli_errmsg("cli_scanjs: fout == NULL\n");
207 207
 	else {
208
+		extern short cli_leavetemps_flag;
208 209
 		JSInterpPtr interp;
209 210
 
210 211
 		fputs("\n}\nmain();\n", fout);
... ...
@@ -221,10 +221,10 @@ cli_scanjs(const char *dir, int desc)
221 221
 			rc = CL_EIO;
222 222
 		}
223 223
 		js_destroy_interp(interp);*/
224
-	}
225 224
 
226
-	if(!cli_leavetemps_flag)
227
-		unlink(script_filename);
225
+		if(!cli_leavetemps_flag)
226
+			unlink(script_filename);
227
+	}
228 228
 
229 229
 	munmap(buf, size);
230 230
 	return CL_CLEAN;