git-svn: trunk@1257

Nigel Horne authored on 2005/01/19 14:29:41
Showing 1 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: binhex.c,v $
20
+ * Revision 1.13  2005/01/19 05:29:41  nigelhorne
21
+ * tidy
22
+ *
20 23
  * Revision 1.12  2004/12/27 14:17:14  nigelhorne
21 24
  * Fix segfault if write to temporary file fails
22 25
  *
... ...
@@ -51,7 +54,7 @@
51 51
  * First draft of binhex.c
52 52
  *
53 53
  */
54
-static	char	const	rcsid[] = "$Id: binhex.c,v 1.12 2004/12/27 14:17:14 nigelhorne Exp $";
54
+static	char	const	rcsid[] = "$Id: binhex.c,v 1.13 2005/01/19 05:29:41 nigelhorne Exp $";
55 55
 
56 56
 #include "clamav.h"
57 57
 
... ...
@@ -105,12 +108,16 @@ cli_binhex(const char *dir, int desc)
105 105
 	if(fstat(desc, &statb) < 0)
106 106
 		return CL_EOPEN;
107 107
 
108
+	size = statb.st_size;
109
+
110
+	if(size == 0)
111
+		return CL_CLEAN;
112
+
108 113
 	m = messageCreate();
109 114
 	if(m == NULL)
110 115
 		return CL_EMEM;
111 116
 
112
-	size = statb.st_size;
113
-	start = buf = mmap(NULL, size, PROT_READ, MAP_PRIVATE, desc, 0);
117
+	start = buf = mmap(NULL, size, PROT_READ, MAP_SHARED, desc, 0);
114 118
 	if(buf == MAP_FAILED) {
115 119
 		messageDestroy(m);
116 120
 		return CL_EMEM;