X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=1cdcf586a2556511e8e1b27558b29f4080b1b02e;hb=07980b056c5371f8b6fdd50172f501be07155bdf;hp=619b90ece9328a0785907222d48df5a1cb0f6188;hpb=7a71d48009e03ff1143a6e1084803f456a27c849;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 619b90ec..1cdcf586 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -714,8 +714,16 @@ static int cmd_start(int argc, char *argv[]) { static int cmd_stop(int argc, char *argv[]) { #ifndef HAVE_MINGW - if(!connect_tincd()) + if(!connect_tincd()) { + if(pid) { + if(kill(pid, SIGTERM)) + return 1; + fprintf(stderr, "Sent TERM signal to process with PID %u.\n", pid); + return 0; + } + return 1; + } sendline(fd, "%d %d", CONTROL, REQ_STOP); if(!recvline(fd, line, sizeof line) || sscanf(line, "%d %d %d", &code, &req, &result) != 3 || code != CONTROL || req != REQ_STOP || result) {