summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blabouncer.c3
-rw-r--r--sockets.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/blabouncer.c b/blabouncer.c
index d6df294..d692d19 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -482,6 +482,9 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) {
sigaddset(&sigset, SIGTERM);
sigprocmask(SIG_BLOCK, &sigset, &oldset);
+ // Extra signal handling to ignore SIGPIPE so failing send() and/or SSL_write() doesn't terminate blabouncer with SIGPIPE
+ signal(SIGPIPE, SIG_IGN);
+
while (1) {
debugprint(DEBUG_FULL, "top of loop, fdmax %d.\n", fdmax);
FD_ZERO(&rfds); // clear entries from fd set
diff --git a/sockets.c b/sockets.c
index 5b4c0c2..2ed993e 100644
--- a/sockets.c
+++ b/sockets.c
@@ -226,7 +226,7 @@ int socksend(SSL *fd, char *buf, int bufsize, int tls) {
// Clear errno in case send() errors
errno = 0;
// Cast the supposed SSL *fd to a long int if we're not using TLS
- return send((long int)fd, buf, bufsize, MSG_NOSIGNAL); // MSG_NOSIGNAL so a bad send() can't SIGPIPE blabouncer
+ return send((long int)fd, buf, bufsize, 0);
}
}