diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-05-13 19:36:40 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-05-13 19:36:40 +0200 |
commit | 3be45bbbdc3f231926a30b2585a69b2e82918460 (patch) | |
tree | 0ee16e6cc65e5f36c80c2d03ead2a3f4427b4380 /src/blogc-runserver | |
parent | acde24745e78806a97588efe382ecae58573438d (diff) | |
download | blogc-3be45bbbdc3f231926a30b2585a69b2e82918460.tar.gz blogc-3be45bbbdc3f231926a30b2585a69b2e82918460.tar.bz2 blogc-3be45bbbdc3f231926a30b2585a69b2e82918460.zip |
runserver: do not ignore ctrl-c. move from signal() to sigaction()
Diffstat (limited to 'src/blogc-runserver')
-rw-r--r-- | src/blogc-runserver/main.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/blogc-runserver/main.c b/src/blogc-runserver/main.c index 1b2df26..dc5a591 100644 --- a/src/blogc-runserver/main.c +++ b/src/blogc-runserver/main.c @@ -45,17 +45,14 @@ print_usage(void) } -void sigint_handler(int sig) { - printf("\n"); - exit(0); -} - - int main(int argc, char **argv) { - signal(SIGPIPE, SIG_IGN); - //signal(SIGINT, sigint_handler); + struct sigaction new_action; + new_action.sa_handler = SIG_IGN; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + sigaction(SIGPIPE, &new_action, NULL); int rv = 0; char *host = NULL; |