Browse code

fix more compiler warnings (bb #273).

git-svn: trunk@4349

Török Edvin authored on 2008/11/07 07:49:53
Showing 6 changed files
... ...
@@ -1,3 +1,9 @@
1
+Thu Nov  6 23:46:07 EET 2008 (edwin)
2
+------------------------------------
3
+ * clamav-milter/clamav-milter.c, clamd/thrmgr.c, freshclam/dns.c,
4
+ libclamav/mspack.c, libclamav/pe.c: fix more compiler warnings (bb
5
+ #273).
6
+
1 7
 Thu Nov  6 21:46:47 CET 2008 (tk)
2 8
 ---------------------------------
3 9
   * docs/clamdoc.tex, docs/man/clamd.8.in: document nCOMMANDS (bb#1278)
... ...
@@ -1926,7 +1926,8 @@ main(int argc, char **argv)
1926 1926
 #else
1927 1927
 			int fds[3];
1928 1928
 			logg_file = NULL;
1929
-			chdir("/");
1929
+			if(chdir("/") < 0)
1930
+				perror("/");
1930 1931
 			fds[0] = open("/dev/null", O_RDONLY);
1931 1932
 			fds[1] = open("/dev/null", O_WRONLY);
1932 1933
 			fds[2] = open("/dev/null", O_WRONLY);
... ...
@@ -168,9 +168,10 @@ int thrmgr_printstats(int f)
168 168
 		const char *state;
169 169
 		work_item_t *q;
170 170
 		struct timeval tv_now;
171
-		unsigned long umin=~0UL, umax=0, usum=0;
172
-		unsigned invalids=0, cnt=0;
171
+		long umin=~0UL, umax=0, usum=0;
172
+		int invalids=0;
173 173
 		struct task_desc *task;
174
+		cnt = 0;
174 175
 
175 176
 		if(!pool) {
176 177
 			mdprintf(f,"NULL\n\n");
... ...
@@ -45,8 +45,8 @@
45 45
 
46 46
 char *txtquery(const char *domain, unsigned int *ttl)
47 47
 {
48
-	unsigned char answer[PACKETSZ], host[128], *pt;
49
-	char *txt;
48
+	unsigned char answer[PACKETSZ], *pt;
49
+	char *txt, host[128];
50 50
 	int len, exp, cttl, size, txtlen, type, qtype;
51 51
 
52 52
 
... ...
@@ -1286,7 +1286,7 @@ int lzx_decompress(struct lzx_stream *lzx, off_t out_bytes) {
1286 1286
 	    }
1287 1287
 	    else {
1288 1288
 	      runsrc = rundest - match_offset;
1289
-	      if(i > (int) lzx->window_size - window_posn)
1289
+	      if(i > (int) (lzx->window_size - window_posn))
1290 1290
 	        i = lzx->window_size - window_posn;
1291 1291
 	      while (i-- > 0) *rundest++ = *runsrc++;
1292 1292
 	    }
... ...
@@ -1902,7 +1902,7 @@ int qtm_decompress(struct qtm_stream *qtm, off_t out_bytes) {
1902 1902
 	}
1903 1903
 	else {
1904 1904
 	  runsrc = rundest - match_offset;
1905
-	  if(i > (int) qtm->window_size - window_posn)
1905
+	  if(i > (int) (qtm->window_size - window_posn))
1906 1906
 	    i = qtm->window_size - window_posn;
1907 1907
 	  while (i-- > 0) *rundest++ = *runsrc++;
1908 1908
 	}
... ...
@@ -176,9 +176,9 @@ FSGSTUFF; \
176 176
     }
177 177
 
178 178
 
179
-#define CLI_UNPRESULTS(NAME,EXPR,GOOD,FREEME) CLI_UNPRESULTS_(NAME,NULL,EXPR,GOOD,FREEME)
179
+#define CLI_UNPRESULTS(NAME,EXPR,GOOD,FREEME) CLI_UNPRESULTS_(NAME,(void)0,EXPR,GOOD,FREEME)
180 180
 #define CLI_UNPRESULTSFSG1(NAME,EXPR,GOOD,FREEME) CLI_UNPRESULTS_(NAME,FSGCASE(NAME,free(sections)),EXPR,GOOD,FREEME)
181
-#define CLI_UNPRESULTSFSG2(NAME,EXPR,GOOD,FREEME) CLI_UNPRESULTS_(NAME,FSGCASE(NAME,NULL),EXPR,GOOD,FREEME)
181
+#define CLI_UNPRESULTSFSG2(NAME,EXPR,GOOD,FREEME) CLI_UNPRESULTS_(NAME,FSGCASE(NAME,(void)0),EXPR,GOOD,FREEME)
182 182
 
183 183
 struct offset_list {
184 184
     uint32_t offset;