X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=4f06daa63bce5d6e6506f761f3b2070ecbcb867d;hb=3fba80174dbe29bcfe0d121a2a1d2e61be5ee57b;hp=f7f23c145266817f7f764f93f5e102cd425aa439;hpb=25091454da21941dd92375ddbee7dd6151343058;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index f7f23c14..4f06daa6 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -76,7 +76,7 @@ static void usage(bool status) { " start Start tincd.\n" " stop Stop tincd.\n" " restart Restart tincd.\n" - " reload Reload configuration of running tincd.\n" + " reload Partially reload configuration of running tincd.\n" " pid Show PID of currently running tincd.\n" " generate-keys [bits] Generate new RSA and ECDSA public/private keypairs.\n" " generate-rsa-keys [bits] Generate a new RSA public/private keypair.\n" @@ -90,7 +90,6 @@ static void usage(bool status) { " purge Purge unreachable nodes\n" " debug N Set debug level\n" " retry Retry all outgoing connections\n" - " reload Partial reload of configuration\n" " disconnect NODE Close meta connection with NODE\n" #ifdef HAVE_CURSES " top Show real-time statistics\n" @@ -504,7 +503,7 @@ static bool remove_service(void) { if(!ControlService(service, SERVICE_CONTROL_STOP, &status)) fprintf(stderr, "Could not stop %s service: %s\n", identname, winerror(GetLastError())); else - fprintf(stderr, "%s service stopped", identname); + fprintf(stderr, "%s service stopped\n", identname); if(!DeleteService(service)) { fprintf(stderr, "Could not remove %s service: %s\n", identname, winerror(GetLastError())); @@ -517,7 +516,7 @@ static bool remove_service(void) { } #endif -int main(int argc, char *argv[], char *envp[]) { +int main(int argc, char *argv[]) { int fd; int result; char host[128]; @@ -569,9 +568,26 @@ int main(int argc, char *argv[], char *envp[]) { } if(!strcasecmp(argv[optind], "start")) { - argv[optind] = NULL; - execve(SBINDIR "/tincd", argv, envp); - fprintf(stderr, "Could not start tincd: %s", strerror(errno)); + int i, j; + char *c; + char *slash = strrchr(argv[0], '/'); +#ifdef HAVE_MINGW + if ((c = strrchr(argv[0], '\\')) > slash) + slash = c; +#endif + if (slash++) { + c = xmalloc((slash - argv[0]) + sizeof("tincd")); + sprintf(c, "%.*stincd", (int)(slash - argv[0]), argv[0]); + } + else + c = "tincd"; + argv[0] = c; + for(i = j = 1; argv[i]; ++i) + if (i != optind && strcmp(argv[i], "--") != 0) + argv[j++] = argv[i]; + argv[j] = NULL; + execvp(c, argv); + fprintf(stderr, "Could not start %s: %s\n", c, strerror(errno)); return 1; }