From: Guus Sliepen Date: Thu, 25 Jul 2013 15:14:07 +0000 (+0200) Subject: Allow control-C to stop tincd without stopping the tinc shell. X-Git-Tag: release-1.1pre8~16 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=d1e01bc880a6970050e55f19bafe8eaf1f0b9be2;p=tinc Allow control-C to stop tincd without stopping the tinc shell. --- diff --git a/src/tincctl.c b/src/tincctl.c index d02bda52..a4965484 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -830,8 +830,16 @@ static int cmd_start(int argc, char *argv[]) { free(nargv); - int status = -1; - if(waitpid(pid, &status, 0) != pid || !WIFEXITED(status) || WEXITSTATUS(status)) { + int status = -1, result; +#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); return 1; }