Try sending SIGTERM if we cannot connect to a tincd but we know its PID.
This commit is contained in:
parent
7a71d48009
commit
07980b056c
1 changed files with 9 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue