git-svn: trunk@4764
Török Edvin authored on 2009/02/13 03:25:17... | ... |
@@ -2,6 +2,7 @@ |
2 | 2 |
#include "clamav-config.h" |
3 | 3 |
#endif |
4 | 4 |
|
5 |
+#include <arpa/inet.h> |
|
5 | 6 |
#include <fcntl.h> |
6 | 7 |
#include <stdio.h> |
7 | 8 |
#include <stdlib.h> |
... | ... |
@@ -93,9 +94,9 @@ static void *recvfull(int sd, size_t *len) |
93 | 93 |
static void test_command(const char *cmd, size_t len, const char *expect, size_t expect_len) |
94 | 94 |
{ |
95 | 95 |
void *recvdata; |
96 |
- int rc; |
|
96 |
+ ssize_t rc; |
|
97 | 97 |
rc = send(sockd, cmd, len, 0); |
98 |
- fail_unless_fmt(rc == len, "Unable to send(): %s\n", strerror(errno)); |
|
98 |
+ fail_unless_fmt((size_t)rc == len, "Unable to send(): %s\n", strerror(errno)); |
|
99 | 99 |
|
100 | 100 |
recvdata = recvfull(sockd, &len); |
101 | 101 |
|
... | ... |
@@ -109,9 +110,7 @@ static void test_command(const char *cmd, size_t len, const char *expect, size_t |
109 | 109 |
|
110 | 110 |
START_TEST (test_basic_commands) |
111 | 111 |
{ |
112 |
- int rc; |
|
113 | 112 |
struct basic_test *test = &basic_tests[_i]; |
114 |
- size_t len; |
|
115 | 113 |
char nsend[BUFSIZ], nreply[BUFSIZ]; |
116 | 114 |
/* send the command the "old way" */ |
117 | 115 |
conn_setup(); |
... | ... |
@@ -127,7 +126,7 @@ START_TEST (test_basic_commands) |
127 | 127 |
|
128 | 128 |
/* send zCOMMAND */ |
129 | 129 |
conn_setup(); |
130 |
- snprintf(nsend, sizeof(nsend), "z%s\0", test->command); |
|
130 |
+ snprintf(nsend, sizeof(nsend), "z%s", test->command); |
|
131 | 131 |
test_command(nsend, strlen(nsend)+1, test->reply, strlen(test->reply)+1); |
132 | 132 |
conn_teardown(); |
133 | 133 |
} |
... | ... |
@@ -163,7 +162,7 @@ START_TEST (tc_instream) |
163 | 163 |
close(fd); |
164 | 164 |
|
165 | 165 |
conn_setup(); |
166 |
- fail_unless(send(sockd, buf, off, 0) == off, "send() failed: %s\n", strerror(errno)); |
|
166 |
+ fail_unless((size_t)send(sockd, buf, off, 0) == off, "send() failed: %s\n", strerror(errno)); |
|
167 | 167 |
|
168 | 168 |
recvdata = recvfull(sockd, &len); |
169 | 169 |
|