From: Guus Sliepen Date: Wed, 13 Jul 2011 20:52:52 +0000 (+0200) Subject: Fix compiler warnings. X-Git-Tag: release-1.1pre2~12 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=303dd1e70219a7542921f6e63d9391ab326d434f;p=tinc Fix compiler warnings. --- diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 41911e42..fe935e1f 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -155,7 +155,7 @@ bool send_metakey_ec(connection_t *c) { b64encode(key, key, ECDH_SIZE + siglen); - bool result = send_request(c, "%d %s", METAKEY, key); + return send_request(c, "%d %s", METAKEY, key); } bool send_metakey(connection_t *c) { diff --git a/src/protocol_key.c b/src/protocol_key.c index fc3707ae..dac13628 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -198,7 +198,7 @@ bool ans_key_h(connection_t *c, char *request) { int cipher, digest, maclength, compression, keylen; node_t *from, *to; - if(sscanf(request, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d "MAX_STRING" "MAX_STRING" %d", + if(sscanf(request, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d "MAX_STRING" "MAX_STRING, from_name, to_name, key, &cipher, &digest, &maclength, &compression, address, port) < 7) { logger(LOG_ERR, "Got bad %s from %s (%s)", "ANS_KEY", c->name, diff --git a/src/tincctl.c b/src/tincctl.c index 7d27341e..ebd2e130 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -405,14 +405,14 @@ bool recvdata(int fd, char *data, size_t len) { bool sendline(int fd, char *format, ...) { static char buffer[4096]; char *p = buffer; - size_t blen = 0; + int blen = 0; va_list ap; va_start(ap, format); blen = vsnprintf(buffer, sizeof buffer, format, ap); va_end(ap); - if(blen < 0 || blen >= sizeof buffer) + if(blen < 1 || blen >= sizeof buffer) return false; buffer[blen] = '\n'; @@ -422,7 +422,7 @@ bool sendline(int fd, char *format, ...) { int result = send(fd, p, blen, 0); if(result == -1 && errno == EINTR) continue; - else if(result <= 0); + else if(result <= 0) return false; p += result; blen -= result; @@ -574,7 +574,7 @@ int main(int argc, char *argv[], char *envp[]) { struct addrinfo *res = NULL; if(getaddrinfo(host, port, &hints, &res) || !res) { - fprintf(stderr, "Cannot resolve %s port %s: %s", host ?: "localhost", port, strerror(errno)); + fprintf(stderr, "Cannot resolve %s port %s: %s", host, port, strerror(errno)); return 1; } @@ -593,7 +593,7 @@ int main(int argc, char *argv[], char *envp[]) { #endif if(connect(fd, res->ai_addr, res->ai_addrlen) < 0) { - fprintf(stderr, "Cannot connect to %s port %s: %s\n", host ?: "localhost", port, sockstrerror(sockerrno)); + fprintf(stderr, "Cannot connect to %s port %s: %s\n", host, port, sockstrerror(sockerrno)); return 1; }