Browse code

fix some warning

git-svn: trunk@5050

Török Edvin authored on 2009/04/20 23:26:53
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Apr 20 17:26:41 EEST 2009 (edwin)
2
+-------------------------------------
3
+ * unit_tests/check_clamd.c: fix some warning
4
+
1 5
 Mon Apr 20 17:20:27 EEST 2009 (edwin)
2 6
 -------------------------------------
3 7
  * clamd/server-th.c, unit_tests/check_clamd.c: Fix clamd INSTREAM
... ...
@@ -124,7 +124,6 @@ static void commands_setup(void)
124 124
 {
125 125
     const char *nonempty = "NONEMPTYFILE";
126 126
     int fd = open(NONEXISTENT, O_RDONLY);
127
-    int rc;
128 127
     if (fd != -1) close(fd);
129 128
     fail_unless(fd == -1, "Nonexistent file exists!\n");
130 129
 
... ...
@@ -136,7 +135,7 @@ static void commands_setup(void)
136 136
     fail_unless_fmt(fchmod(fd,  S_IWUSR) != -1,
137 137
 		    "Failed to chmod: %s\n", strerror(errno));
138 138
     /* must not be empty file */
139
-    fail_unless_fmt(write(fd, nonempty, strlen(nonempty)) == strlen(nonempty),
139
+    fail_unless_fmt((size_t)write(fd, nonempty, strlen(nonempty)) == strlen(nonempty),
140 140
 		    "Failed to write into testfile: %s\n", strerror(errno));
141 141
     close(fd);
142 142
 
... ...
@@ -443,7 +442,6 @@ static int sendmsg_fd(int sockd, const char *mesg, size_t msg_len, int fd, int s
443 443
 static void tst_fildes(const char *cmd, size_t len, int fd,
444 444
 			const char *expect, size_t expect_len, int closefd, int singlemsg)
445 445
 {
446
-    off_t pos;
447 446
     char *recvdata, *p;
448 447
     int rc;
449 448
 
... ...
@@ -495,9 +493,8 @@ START_TEST (test_fildes)
495 495
 {
496 496
     char nreply[BUFSIZ], nsend[BUFSIZ];
497 497
     int fd = open(SCANFILE, O_RDONLY);
498
-    int closefd;
499
-    int singlemsg;
500
-    size_t i;
498
+    int closefd=0;
499
+    int singlemsg=0;
501 500
     const struct cmds *cmd;
502 501
     size_t nreply_len, nsend_len;
503 502
 
... ...
@@ -542,7 +539,7 @@ END_TEST
542 542
 START_TEST (test_fildes_many)
543 543
 {
544 544
     const char idsession[] = "zIDSESSION";
545
-    int dummyfd, dummycleanfd, i, killed = 0;
545
+    int dummyfd, i, killed = 0;
546 546
     conn_setup();
547 547
     dummyfd = open(SCANFILE, O_RDONLY);
548 548
     fail_unless_fmt(dummyfd != -1, "failed to open %s: %s\n", SCANFILE, strerror(errno));
... ...
@@ -627,7 +624,7 @@ END_TEST
627 627
 START_TEST (test_connections)
628 628
 {
629 629
     int rc;
630
-    size_t i;
630
+    int i;
631 631
     struct rlimit rlim;
632 632
     int *sock;
633 633
     int nf, maxfd=0;
... ...
@@ -758,7 +755,6 @@ static void test_idsession_commands(int split, int instream)
758 758
 	}
759 759
 	if (instream && test->ids == IDS_END) {
760 760
 	    uint32_t chunk;
761
-	    int fd;
762 761
 	    /* IDS_END - in middle of other commands, perfect for inserting
763 762
 	     * INSTREAM */
764 763
 	    fail_unless(p+sizeof(INSTREAM_CMD)+544< buf+sizeof(buf), "Buffer too small");
... ...
@@ -787,10 +783,10 @@ static void test_idsession_commands(int split, int instream)
787 787
 
788 788
     if (split) {
789 789
 	/* test corner-cases: 1-byte sends */
790
-	for (i=0;i<p-buf;i++)
790
+	for (i=0;i<(size_t)(p-buf);i++)
791 791
 	    fail_unless((size_t)send(sockd, &buf[i], 1, 0) == 1, "send() failed: %u, %s\n", i, strerror(errno));
792 792
     } else {
793
-	fail_unless((size_t)send(sockd, buf, p-buf, 0) == p-buf,"send() failed: %s\n", strerror(errno));
793
+	fail_unless(send(sockd, buf, p-buf, 0) == p-buf,"send() failed: %s\n", strerror(errno));
794 794
     }
795 795
     recvdata = recvfull(sockd, &len);
796 796
     p = recvdata;