projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Attempt to make the test suite work with Windows executables.
[tinc]
/
src
/
sptps_test.c
diff --git
a/src/sptps_test.c
b/src/sptps_test.c
index
9b7c289
..
ea81a28
100644
(file)
--- a/
src/sptps_test.c
+++ b/
src/sptps_test.c
@@
-32,12
+32,20
@@
// Symbols necessary to link with logger.o
bool send_request(void *c, const char *msg, ...) {
// Symbols necessary to link with logger.o
bool send_request(void *c, const char *msg, ...) {
+ (void)c;
+ (void)msg;
return false;
}
return false;
}
+
struct list_t *connection_list = NULL;
struct list_t *connection_list = NULL;
+
bool send_meta(void *c, const char *msg, int len) {
bool send_meta(void *c, const char *msg, int len) {
+ (void)c;
+ (void)msg;
+ (void)len;
return false;
}
return false;
}
+
char *logfilename = NULL;
bool do_detach = false;
struct timeval now;
char *logfilename = NULL;
bool do_detach = false;
struct timeval now;
@@
-51,6
+59,7
@@
static int out = 1;
static int addressfamily = AF_UNSPEC;
static bool send_data(void *handle, uint8_t type, const void *data, size_t len) {
static int addressfamily = AF_UNSPEC;
static bool send_data(void *handle, uint8_t type, const void *data, size_t len) {
+ (void)type;
char hex[len * 2 + 1];
bin2hex(data, hex, len);
char hex[len * 2 + 1];
bin2hex(data, hex, len);
@@
-60,7
+69,7
@@
static bool send_data(void *handle, uint8_t type, const void *data, size_t len)
const int *sock = handle;
const int *sock = handle;
- if(send(*sock, data, len, 0) != len) {
+ if(
(size_t)
send(*sock, data, len, 0) != len) {
return false;
}
return false;
}
@@
-68,6
+77,8
@@
static bool send_data(void *handle, uint8_t type, const void *data, size_t len)
}
static bool receive_record(void *handle, uint8_t type, const void *data, uint16_t len) {
}
static bool receive_record(void *handle, uint8_t type, const void *data, uint16_t len) {
+ (void)handle;
+
if(verbose) {
fprintf(stderr, "Received type %d record of %u bytes:\n", type, len);
}
if(verbose) {
fprintf(stderr, "Received type %d record of %u bytes:\n", type, len);
}
@@
-359,6
+370,7
@@
int main(int argc, char *argv[]) {
}
char buf[65535] = "";
}
char buf[65535] = "";
+ size_t readsize = datagram ? 1460u : sizeof(buf);
fd_set fds;
FD_ZERO(&fds);
fd_set fds;
FD_ZERO(&fds);
@@
-376,7
+388,7
@@
int main(int argc, char *argv[]) {
}
if(FD_ISSET(in, &fds)) {
}
if(FD_ISSET(in, &fds)) {
- ssize_t len = read(in, buf,
sizeof(buf)
);
+ ssize_t len = read(in, buf,
readsize
);
if(len < 0) {
fprintf(stderr, "Could not read from stdin: %s\n", strerror(errno));
if(len < 0) {
fprintf(stderr, "Could not read from stdin: %s\n", strerror(errno));
@@
-404,7
+416,7
@@
int main(int argc, char *argv[]) {
if(len > 1) {
sptps_send_record(&s, 0, buf, len);
}
if(len > 1) {
sptps_send_record(&s, 0, buf, len);
}
- } else if(!sptps_send_record(&s, buf[0] == '!' ? 1 : 0, buf, (len == 1 && buf[0] == '\n') ? 0 : buf[0] == '*' ? sizeof(buf) : len)) {
+ } else if(!sptps_send_record(&s, buf[0] == '!' ? 1 : 0, buf, (len == 1 && buf[0] == '\n') ? 0 : buf[0] == '*' ? sizeof(buf) :
(size_t)
len)) {
return 1;
}
}
return 1;
}
}
@@
-445,8
+457,6
@@
int main(int argc, char *argv[]) {
if(!datagram) {
return 1;
}
if(!datagram) {
return 1;
}
- } else {
- break;
}
bufp += done;
}
bufp += done;