X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=98f4a1b9093b2d792b3cbbda8160b9244b80d528;hb=ab4d289fafd1d391583935ab4c306f1f508ea1d0;hp=7ed79b1a67e9241d47edb419cae4fa4065aeb1f8;hpb=a05fa7f88264599a43f9e411287e018259dc22b1;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 7ed79b1a..98f4a1b9 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -44,7 +44,6 @@ static char *pidfilename = NULL; /* pid file location */ static char controlcookie[1024]; char *netname = NULL; char *confbase = NULL; -static char *host = NULL; #ifdef HAVE_MINGW static struct WSAData wsa_state; @@ -52,7 +51,6 @@ static struct WSAData wsa_state; static struct option const long_options[] = { {"config", required_argument, NULL, 'c'}, - {"host", required_argument, NULL, 'h'}, {"net", required_argument, NULL, 'n'}, {"help", no_argument, NULL, 1}, {"version", no_argument, NULL, 2}, @@ -104,7 +102,7 @@ static bool parse_options(int argc, char **argv) { int r; int option_index = 0; - while((r = getopt_long(argc, argv, "c:n:h:", long_options, &option_index)) != EOF) { + while((r = getopt_long(argc, argv, "c:n:", long_options, &option_index)) != EOF) { switch (r) { case 0: /* long option */ break; @@ -113,10 +111,6 @@ static bool parse_options(int argc, char **argv) { confbase = xstrdup(optarg); break; - case 'h': /* alternative host to connect to */ - host = xstrdup(optarg); - break; - case 'n': /* net name given */ netname = xstrdup(optarg); break; @@ -429,6 +423,7 @@ void pcap(int fd, FILE *out) { int main(int argc, char *argv[], char *envp[]) { int fd; int result; + char host[128]; char port[128]; int pid; @@ -487,7 +482,7 @@ int main(int argc, char *argv[], char *envp[]) { fprintf(stderr, "Could not open pid file %s: %s\n", pidfilename, strerror(errno)); return 1; } - if(fscanf(f, "%1024s %128s %20d", controlcookie, port, &pid) != 3) { + if(fscanf(f, "%20d %1024s %128s port %128s", &pid, controlcookie, host, port) != 4) { fprintf(stderr, "Could not parse pid file %s\n", pidfilename); return 1; }