Fix parsing of -b flag
[tinc] / src / tincctl.c
index 6f4fb93..766b769 100644 (file)
@@ -168,7 +168,7 @@ static bool parse_options(int argc, char **argv) {
        int r;
        int option_index = 0;
 
-       while((r = getopt_long(argc, argv, "+c:n:", long_options, &option_index)) != EOF) {
+       while((r = getopt_long(argc, argv, "+bc:n:", long_options, &option_index)) != EOF) {
                switch (r) {
                        case 0:   /* long option */
                                break;
@@ -513,7 +513,7 @@ bool recvline(int fd, char *line, size_t len) {
        char *newline = NULL;
 
        if(!fd)
-               abort();
+               return false;
 
        while(!(newline = memchr(buffer, '\n', blen))) {
                int result = recv(fd, buffer + blen, sizeof buffer - blen, 0);
@@ -951,11 +951,11 @@ static int cmd_stop(int argc, char *argv[]) {
        if(!connect_tincd(true)) {
                if(pid) {
                        if(kill(pid, SIGTERM)) {
-                               fprintf(stderr, "Could not send TERM signal to process with PID %u: %s\n", pid, strerror(errno));
+                               fprintf(stderr, "Could not send TERM signal to process with PID %d: %s\n", pid, strerror(errno));
                                return 1;
                        }
 
-                       fprintf(stderr, "Sent TERM signal to process with PID %u.\n", pid);
+                       fprintf(stderr, "Sent TERM signal to process with PID %d.\n", pid);
                        waitpid(pid, NULL, 0);
                        return 0;
                }
@@ -1030,7 +1030,6 @@ static int dump_invitations(void) {
                FILE *f = fopen(fname, "r");
                if(!f) {
                        fprintf(stderr, "Cannot open %s: %s\n", fname, strerror(errno));
-                       fclose(f);
                        continue;
                }
 
@@ -1175,7 +1174,7 @@ static int cmd_dump(int argc, char *argv[]) {
                                } else {
                                        if(only_reachable && !status.reachable)
                                                continue;
-                                       printf("%s id %s at %s port %s cipher %d digest %d maclength %d compression %d options %x status %04x nexthop %s via %s distance %d pmtu %hd (min %hd max %hd)\n",
+                                       printf("%s id %s at %s port %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)\n",
                                                        node, id, host, port, cipher, digest, maclength, compression, options, status_int, nexthop, via, distance, pmtu, minmtu, maxmtu);
                                }
                        } break;
@@ -1491,9 +1490,11 @@ const var_t variables[] = {
        {"Hostnames", VAR_SERVER},
        {"IffOneQueue", VAR_SERVER},
        {"Interface", VAR_SERVER},
+       {"InvitationExpire", VAR_SERVER},
        {"KeyExpire", VAR_SERVER},
        {"ListenAddress", VAR_SERVER | VAR_MULTIPLE},
        {"LocalDiscovery", VAR_SERVER},
+       {"LogLevel", VAR_SERVER},
        {"MACExpire", VAR_SERVER},
        {"MaxConnectionBurst", VAR_SERVER},
        {"MaxOutputBufferSize", VAR_SERVER},
@@ -2826,8 +2827,6 @@ static int cmd_shell(int argc, char *argv[]) {
 
                while(p && *p) {
                        if(nargc >= maxargs) {
-                               fprintf(stderr, "next %p '%s', p %p '%s'\n", next, next, p, p);
-                               abort();
                                maxargs *= 2;
                                nargv = xrealloc(nargv, maxargs * sizeof *nargv);
                        }