fix some warning

git-svn: trunk@5050
0.95
Török Edvin 16 years ago
parent 47d403f899
commit e9e0833f5c
  1. 4
      ChangeLog
  2. 18
      unit_tests/check_clamd.c

@ -1,3 +1,7 @@
Mon Apr 20 17:26:41 EEST 2009 (edwin)
-------------------------------------
* unit_tests/check_clamd.c: fix some warning
Mon Apr 20 17:20:27 EEST 2009 (edwin) Mon Apr 20 17:20:27 EEST 2009 (edwin)
------------------------------------- -------------------------------------
* clamd/server-th.c, unit_tests/check_clamd.c: Fix clamd INSTREAM * clamd/server-th.c, unit_tests/check_clamd.c: Fix clamd INSTREAM

@ -124,7 +124,6 @@ static void commands_setup(void)
{ {
const char *nonempty = "NONEMPTYFILE"; const char *nonempty = "NONEMPTYFILE";
int fd = open(NONEXISTENT, O_RDONLY); int fd = open(NONEXISTENT, O_RDONLY);
int rc;
if (fd != -1) close(fd); if (fd != -1) close(fd);
fail_unless(fd == -1, "Nonexistent file exists!\n"); fail_unless(fd == -1, "Nonexistent file exists!\n");
@ -136,7 +135,7 @@ static void commands_setup(void)
fail_unless_fmt(fchmod(fd, S_IWUSR) != -1, fail_unless_fmt(fchmod(fd, S_IWUSR) != -1,
"Failed to chmod: %s\n", strerror(errno)); "Failed to chmod: %s\n", strerror(errno));
/* must not be empty file */ /* must not be empty file */
fail_unless_fmt(write(fd, nonempty, strlen(nonempty)) == strlen(nonempty), fail_unless_fmt((size_t)write(fd, nonempty, strlen(nonempty)) == strlen(nonempty),
"Failed to write into testfile: %s\n", strerror(errno)); "Failed to write into testfile: %s\n", strerror(errno));
close(fd); close(fd);
@ -443,7 +442,6 @@ static int sendmsg_fd(int sockd, const char *mesg, size_t msg_len, int fd, int s
static void tst_fildes(const char *cmd, size_t len, int fd, static void tst_fildes(const char *cmd, size_t len, int fd,
const char *expect, size_t expect_len, int closefd, int singlemsg) const char *expect, size_t expect_len, int closefd, int singlemsg)
{ {
off_t pos;
char *recvdata, *p; char *recvdata, *p;
int rc; int rc;
@ -495,9 +493,8 @@ START_TEST (test_fildes)
{ {
char nreply[BUFSIZ], nsend[BUFSIZ]; char nreply[BUFSIZ], nsend[BUFSIZ];
int fd = open(SCANFILE, O_RDONLY); int fd = open(SCANFILE, O_RDONLY);
int closefd; int closefd=0;
int singlemsg; int singlemsg=0;
size_t i;
const struct cmds *cmd; const struct cmds *cmd;
size_t nreply_len, nsend_len; size_t nreply_len, nsend_len;
@ -542,7 +539,7 @@ END_TEST
START_TEST (test_fildes_many) START_TEST (test_fildes_many)
{ {
const char idsession[] = "zIDSESSION"; const char idsession[] = "zIDSESSION";
int dummyfd, dummycleanfd, i, killed = 0; int dummyfd, i, killed = 0;
conn_setup(); conn_setup();
dummyfd = open(SCANFILE, O_RDONLY); dummyfd = open(SCANFILE, O_RDONLY);
fail_unless_fmt(dummyfd != -1, "failed to open %s: %s\n", SCANFILE, strerror(errno)); fail_unless_fmt(dummyfd != -1, "failed to open %s: %s\n", SCANFILE, strerror(errno));
@ -627,7 +624,7 @@ END_TEST
START_TEST (test_connections) START_TEST (test_connections)
{ {
int rc; int rc;
size_t i; int i;
struct rlimit rlim; struct rlimit rlim;
int *sock; int *sock;
int nf, maxfd=0; int nf, maxfd=0;
@ -758,7 +755,6 @@ static void test_idsession_commands(int split, int instream)
} }
if (instream && test->ids == IDS_END) { if (instream && test->ids == IDS_END) {
uint32_t chunk; uint32_t chunk;
int fd;
/* IDS_END - in middle of other commands, perfect for inserting /* IDS_END - in middle of other commands, perfect for inserting
* INSTREAM */ * INSTREAM */
fail_unless(p+sizeof(INSTREAM_CMD)+544< buf+sizeof(buf), "Buffer too small"); 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)
if (split) { if (split) {
/* test corner-cases: 1-byte sends */ /* test corner-cases: 1-byte sends */
for (i=0;i<p-buf;i++) for (i=0;i<(size_t)(p-buf);i++)
fail_unless((size_t)send(sockd, &buf[i], 1, 0) == 1, "send() failed: %u, %s\n", i, strerror(errno)); fail_unless((size_t)send(sockd, &buf[i], 1, 0) == 1, "send() failed: %u, %s\n", i, strerror(errno));
} else { } else {
fail_unless((size_t)send(sockd, buf, p-buf, 0) == p-buf,"send() failed: %s\n", strerror(errno)); fail_unless(send(sockd, buf, p-buf, 0) == p-buf,"send() failed: %s\n", strerror(errno));
} }
recvdata = recvfull(sockd, &len); recvdata = recvfull(sockd, &len);
p = recvdata; p = recvdata;

Loading…
Cancel
Save