From 3be45bbbdc3f231926a30b2585a69b2e82918460 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sun, 13 May 2018 19:36:40 +0200 Subject: runserver: do not ignore ctrl-c. move from signal() to sigaction() --- src/blogc-runserver/main.c | 13 +++++-------- 1 file 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; -- cgit v1.2.3-18-g5258