From 5d78e497f1c352c8d490eed1d44d128523a34572 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 11 Dec 2009 22:38:06 +0100 Subject: [PATCH] Fix compiler warnings. --- src/control.c | 5 +---- src/node.c | 2 +- src/tincctl.c | 8 ++++---- src/tincd.c | 3 +++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/control.c b/src/control.c index 22078151..e3901a6d 100644 --- a/src/control.c +++ b/src/control.c @@ -28,9 +28,6 @@ #include "utils.h" #include "xalloc.h" -static int control_socket = -1; -static struct event control_event; -static splay_tree_t *control_socket_tree; char controlcookie[65]; extern char *controlcookiename; @@ -112,7 +109,7 @@ bool init_control() { } #ifdef HAVE_FCHMOD - fchmod(f, 0600); + fchmod(fileno(f), 0600); #else chmod(controlcookiename, 0600); #endif diff --git a/src/node.c b/src/node.c index e3eca447..0159f9dd 100644 --- a/src/node.c +++ b/src/node.c @@ -161,7 +161,7 @@ bool dump_nodes(connection_t *c) { for(node = node_tree->head; node; node = node->next) { n = node->data; - send_request(c, "%d %d %s at %s cipher %d digest %d maclength %d compression %d options %x status %04x nexthop %s via %s distance %d pmtu %d (min %d max %d)", CONTROL, REQ_DUMP_NODES, + send_request(c, "%d %d %s at %s cipher %d digest %d maclength %zd compression %d options %x status %04x nexthop %s via %s distance %d pmtu %d (min %d max %d)", CONTROL, REQ_DUMP_NODES, n->name, n->hostname, cipher_get_nid(&n->outcipher), digest_get_nid(&n->outdigest), digest_length(&n->outdigest), n->outcompression, n->options, bitfield_to_int(&n->status, sizeof n->status), n->nexthop ? n->nexthop->name : "-", diff --git a/src/tincctl.c b/src/tincctl.c index 2d2e2f25..ede186ad 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -58,7 +58,7 @@ static struct option const long_options[] = { {"net", required_argument, NULL, 'n'}, {"help", no_argument, NULL, 1}, {"version", no_argument, NULL, 2}, - {"controlsocket", required_argument, NULL, 5}, + {"controlcookie", required_argument, NULL, 5}, {NULL, 0, NULL, 0} }; @@ -282,7 +282,7 @@ static void make_names(void) { #endif if(!controlcookiename) - xasprintf(&controlcookiename, "%s/run/%s.control/socket", LOCALSTATEDIR, identname); + xasprintf(&controlcookiename, "%s/run/%s.cookie", LOCALSTATEDIR, identname); if(netname) { if(!confbase) @@ -540,7 +540,7 @@ int main(int argc, char *argv[], char *envp[]) { while(recvline(fd, line, sizeof line)) { char node1[4096], node2[4096]; - int n = sscanf(line, "%d %d %s to %s", &code, &req, &node1, &node2); + int n = sscanf(line, "%d %d %s to %s", &code, &req, node1, node2); if(n == 2) { if(do_graph && req == REQ_DUMP_NODES) continue; @@ -586,7 +586,7 @@ int main(int argc, char *argv[], char *envp[]) { debuglevel = atoi(argv[optind+1]); sendline(fd, "%d %d %d", CONTROL, REQ_SET_DEBUG, debuglevel); - if(!recvline(fd, line, sizeof line) || sscanf(line, "%d %d %d", &code, &req, &result) != 3 || code != CONTROL || req != REQ_SET_DEBUG) { + if(!recvline(fd, line, sizeof line) || sscanf(line, "%d %d %d", &code, &req, &origlevel) != 3 || code != CONTROL || req != REQ_SET_DEBUG) { fprintf(stderr, "Could not purge tinc daemon\n"); return 1; } diff --git a/src/tincd.c b/src/tincd.c index f6cda972..9c6009e1 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -243,6 +243,9 @@ static void make_names(void) { if(!logfilename) xasprintf(&logfilename, LOCALSTATEDIR "/log/%s.log", identname); + if(!controlcookiename) + xasprintf(&controlcookiename, LOCALSTATEDIR "/run/%s.cookie", identname); + if(netname) { if(!confbase) xasprintf(&confbase, CONFDIR "/tinc/%s", netname); -- 2.20.1