summaryrefslogtreecommitdiffstats
path: root/osdep/terminal-unix.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-20 21:45:12 +0100
committerwm4 <wm4@nowhere>2014-11-20 21:45:12 +0100
commitf93ce21d4572221bfc2863c0237ef919f0883f02 (patch)
tree4315f6a55d7613761a5c3b8ccc5d270d09347546 /osdep/terminal-unix.c
parent8a1d5e91ade98b8664f873545bb76b3398a6cc08 (diff)
downloadmpv-f93ce21d4572221bfc2863c0237ef919f0883f02.tar.bz2
mpv-f93ce21d4572221bfc2863c0237ef919f0883f02.tar.xz
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.
Diffstat (limited to 'osdep/terminal-unix.c')
-rw-r--r--osdep/terminal-unix.c3
1 files changed, 3 insertions, 0 deletions
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;