diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-09-15 17:17:51 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-09-15 17:17:51 +0100 |
commit | 5550f2f5aeb8f9f1aa3af8159cffda6e7c6d38a2 (patch) | |
tree | ec5810c06a7c669c6ddd58e818e709ec8e75d982 | |
parent | aab7a7000cff14afe4cb331721ad55dc139f80c7 (diff) |
Set the MSG_NOSIGNAL flag send send()ing so a bad socket write doesn't terminate blabouncer with SIGPIPE.
-rw-r--r-- | sockets.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -223,8 +223,10 @@ int socksend(SSL *fd, char *buf, int bufsize, int tls) { if (tls) { return SSL_write(fd, buf, bufsize); } else { + // 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, 0); + return send((long int)fd, buf, bufsize, MSG_NOSIGNAL); // MSG_NOSIGNAL so a bad send() can't SIGPIPE blabouncer } } |