X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=da66c8ffb441d931810c643cf887613689fefc6e;hb=313a752cb5fbf27450d34c15b0085d2d8a4147af;hp=5f2b135103f2b761313aabe3f1c66c5228617d8e;hpb=f0e7e6b03e34e69cac5b01a2d943ad3b9b59d36c;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 5f2b1351..da66c8ff 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -246,7 +246,7 @@ static void disable_old_keys(const char *filename, const char *what) { while(fgets(buf, sizeof buf, r)) { if(!block && !strncmp(buf, "-----BEGIN ", 11)) { - if((strstr(buf, " RSA ") && strstr(what, "RSA"))) { + if((strstr(buf, " ED25519 ") && strstr(what, "Ed25519")) || (strstr(buf, " RSA ") && strstr(what, "RSA"))) { disabled = true; block = true; } @@ -485,7 +485,7 @@ bool recvline(int fd, char *line, size_t len) { while(!(newline = memchr(buffer, '\n', blen))) { int result = recv(fd, buffer + blen, sizeof buffer - blen, 0); - if(result == -1 && errno == EINTR) + if(result == -1 && sockerrno == EINTR) continue; else if(result <= 0) return false; @@ -511,7 +511,7 @@ bool recvdata(int fd, char *data, size_t len) { while(blen < len) { int result = recv(fd, buffer + blen, sizeof buffer - blen, 0); - if(result == -1 && errno == EINTR) + if(result == -1 && sockerrno == EINTR) continue; else if(result <= 0) return false; @@ -543,7 +543,7 @@ bool sendline(int fd, char *format, ...) { while(blen) { int result = send(fd, p, blen, MSG_NOSIGNAL); - if(result == -1 && errno == EINTR) + if(result == -1 && sockerrno == EINTR) continue; else if(result <= 0) return false; @@ -723,7 +723,7 @@ bool connect_tincd(bool verbose) { if(getaddrinfo(host, port, &hints, &res) || !res) { if(verbose) - fprintf(stderr, "Cannot resolve %s port %s: %s", host, port, strerror(errno)); + fprintf(stderr, "Cannot resolve %s port %s: %s", host, port, sockstrerror(sockerrno)); return false; } @@ -1613,7 +1613,7 @@ static int cmd_config(int argc, char *argv[]) { if(action < -1) { if(!found) fprintf(stderr, "No matching configuration variables found.\n"); - return 0; + return 1; } // Make sure we wrote everything... @@ -1626,7 +1626,7 @@ static int cmd_config(int argc, char *argv[]) { if(action < 0 && !removed) { remove(tmpfile); fprintf(stderr, "No configuration variables deleted.\n"); - return *value != 0; + return 1; } // Replace the configuration file with the new one