summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.c b/main.c
index 52d10bd..0b4886b 100644
--- a/main.c
+++ b/main.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE // sigaction
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
@@ -142,7 +143,14 @@ int main(int argc,char **argv){
return 1;
}
- signal(SIGCHLD,signal_handler);
+ struct sigaction sa;
+ sa.sa_handler=signal_handler;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags=SA_RESTART;
+ if(sigaction(SIGCHLD,&sa,NULL)<0){
+ perror("sigaction");
+ return 1;
+ }
printf("Listening on port %d\n",PORT);