aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-runserver/main.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-05-13 19:36:40 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-05-13 19:36:40 +0200
commit3be45bbbdc3f231926a30b2585a69b2e82918460 (patch)
tree0ee16e6cc65e5f36c80c2d03ead2a3f4427b4380 /src/blogc-runserver/main.c
parentacde24745e78806a97588efe382ecae58573438d (diff)
downloadblogc-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/main.c')
-rw-r--r--src/blogc-runserver/main.c13
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;