Allow control-C to stop tincd without stopping the tinc shell.
This commit is contained in:
parent
d219fe2c09
commit
d1e01bc880
1 changed files with 10 additions and 2 deletions
|
@ -830,8 +830,16 @@ static int cmd_start(int argc, char *argv[]) {
|
||||||
|
|
||||||
free(nargv);
|
free(nargv);
|
||||||
|
|
||||||
int status = -1;
|
int status = -1, result;
|
||||||
if(waitpid(pid, &status, 0) != pid || !WIFEXITED(status) || WEXITSTATUS(status)) {
|
#ifdef SIGINT
|
||||||
|
signal(SIGINT, SIG_IGN);
|
||||||
|
#endif
|
||||||
|
result = waitpid(pid, &status, 0);
|
||||||
|
#ifdef SIGINT
|
||||||
|
signal(SIGINT, SIG_DFL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(result != pid || !WIFEXITED(status) || WEXITSTATUS(status)) {
|
||||||
fprintf(stderr, "Error starting %s\n", c);
|
fprintf(stderr, "Error starting %s\n", c);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue