projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7a71d48
)
Try sending SIGTERM if we cannot connect to a tincd but we know its PID.
author
Guus Sliepen
<guus@tinc-vpn.org>
Wed, 1 Aug 2012 13:14:48 +0000
(15:14 +0200)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Wed, 1 Aug 2012 13:14:48 +0000
(15:14 +0200)
src/tincctl.c
patch
|
blob
|
history
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
619b90e
..
1cdcf58
100644
(file)
--- 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
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;
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) {
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) {