X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=b15676c88f55f4e9423bd384f5a9e5aba132620e;hb=1ac9a3fbd18f961d604c2c080374b8fc32f155d6;hp=c0c8a25662bb17ce1b08e97ed7b4f6cb7d98c8a0;hpb=cc9203ee75c49360dd29710ac12bb67fe503f97b;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index c0c8a256..b15676c8 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -763,7 +763,7 @@ bool connect_tincd(bool verbose) { #ifdef SO_NOSIGPIPE static const int one = 1; - setsockopt(c, SOL_SOCKET, SO_NOSIGPIPE, (void *)&one, sizeof one); + setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&one, sizeof one); #endif char data[4096]; @@ -1305,7 +1305,7 @@ char *get_my_name(bool verbose) { continue; if(*value) { fclose(f); - return strdup(value); + return replace_name(value); } } @@ -1635,9 +1635,12 @@ static int cmd_config(int argc, char *argv[]) { } if(action < -1) { - if(!found) + if(found) { + return 0; + } else { fprintf(stderr, "No matching configuration variables found.\n"); - return 1; + return 1; + } } // Make sure we wrote everything... @@ -1672,18 +1675,6 @@ static int cmd_config(int argc, char *argv[]) { return 0; } -bool check_id(const char *name) { - if(!name || !*name) - return false; - - for(int i = 0; i < strlen(name); i++) { - if(!isalnum(name[i]) && name[i] != '_') - return false; - } - - return true; -} - static bool try_bind(int port) { struct addrinfo *ai = NULL; struct addrinfo hint = {