Fix compiler warnings.
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 11 Dec 2009 21:38:06 +0000 (22:38 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 11 Dec 2009 21:38:06 +0000 (22:38 +0100)
src/control.c
src/node.c
src/tincctl.c
src/tincd.c

index 2207815..e3901a6 100644 (file)
@@ -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
index e3eca44..0159f9d 100644 (file)
@@ -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 : "-",
index 2d2e2f2..ede186a 100644 (file)
@@ -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;
                }
index f6cda97..9c6009e 100644 (file)
@@ -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);