From f93ce21d4572221bfc2863c0237ef919f0883f02 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 20 Nov 2014 21:45:12 +0100 Subject: Catch SIGPIPE Avoids a crash if OpenSSL tries to write to a broken connection with write(). Obviously OpenSSL really should use send() with MSG_NOSIGNAL, but for some reason it doesn't. This should probably be considered an OpenSSL bug, but since in this case we "own" the process, there is no harm in ignoring the signal. This is not done with libmpv, because as a library we don't want to mess with global state. It's also not done if terminal handling is disabled - this is a bit arbitrary, but I don't care much. --- osdep/terminal-unix.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'osdep/terminal-unix.c') diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c index 5115666afc..85908c551a 100644 --- a/osdep/terminal-unix.c +++ b/osdep/terminal-unix.c @@ -488,6 +488,9 @@ int terminal_init(void) setsigaction(SIGTTIN, SIG_IGN, 0, true); setsigaction(SIGTTOU, SIG_IGN, 0, true); + // don't crash on SIGPIPE caused by semi-broken libraries + setsigaction(SIGPIPE, SIG_IGN, 0, true); + getch2_poll(); return 0; -- cgit v1.2.3