aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-05-24 09:43:55 +0200
committertomsmeding <tom.smeding@gmail.com>2017-05-24 09:43:55 +0200
commite4914ccdfa4d9eb6f71f7b5cc5b4881c4e911778 (patch)
treed4e9996e9e18e1f90a1e1d0b36a6297e78ed0894
parent0cfd3e87bba5faee5994dc915ab6485f0cf6832c (diff)
server: Ignore SIGPIPE
-rw-r--r--main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.c b/main.c
index 891e19f..6388fe2 100644
--- a/main.c
+++ b/main.c
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
@@ -148,9 +149,17 @@ void srandomdev(void){
}
#endif
+void signal_handler(int sig){
+ if(sig==SIGPIPE){
+ // ignore
+ }
+}
+
int main(int argc,char **argv){
srandomdev();
+ signal(SIGPIPE,signal_handler);
+
plugin_init();
for(int i=1;i<argc;i++){
plugin_register(argv[i]);