aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2020-11-03 15:48:26 +0100
committerOmar Polo <op@omarpolo.com>2020-11-03 15:48:26 +0100
commit0cf902af628108c5038cd20f5958d524a812e232 (patch)
treed0e255b1a353564bdba7a03c1c9418d256dab03b
parent9468027ba731a6ca955df8f49edd51cb4b46390a (diff)
ignore SIGPIPE
bad clients can shutdown the socket and we will exit due to a SIGPIPE. it ain’t fun.
-rw-r--r--gmid.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gmid.c b/gmid.c
index 1a5de19..171b6d2 100644
--- a/gmid.c
+++ b/gmid.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -668,6 +669,8 @@ main(int argc, char **argv)
struct tls_config *conf;
int sock, ch;
+ signal(SIGPIPE, SIG_IGN);
+
while ((ch = getopt(argc, argv, "c:d:hk:")) != -1) {
switch (ch) {
case 'c':