summaryrefslogtreecommitdiffstats
path: root/player/main.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-11 17:38:35 +0200
committerwm4 <wm4@nowhere>2015-05-11 17:38:35 +0200
commit4858c47e1c6ea51bad409fa8ee56aeb05a7a3778 (patch)
treec939f9371122633365895b9f78fbf854a36ca5b6 /player/main.c
parenta5aa58c63c6f0b1ee43d8ac90e0ae0dd57de194a (diff)
downloadmpv-4858c47e1c6ea51bad409fa8ee56aeb05a7a3778.tar.bz2
mpv-4858c47e1c6ea51bad409fa8ee56aeb05a7a3778.tar.xz
Always block SIGPIPE globally
OpenSSL and GnuTLS are still causing this problem (although FFmpeg could be blamed as well - but not really). In particular, it was happening to libmpv users and in cases the pseudo-gui profile is used. This was because all signal handling is in the terminal code, so if terminal is disabled, it won't be set. This was obviously a questionable shortcut. Avoid further problems by always blocking the signal. This is done even for libmpv, despite our policy of not messing with global state. Explicitly document this in the libmpv docs. It turns out that a version bump to 1.17 was forgotten for the addition of MPV_FORMAT_BYTE_ARRAY, so document that change as part of 1.16.
Diffstat (limited to 'player/main.c')
-rw-r--r--player/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/player/main.c b/player/main.c
index b80bc994bb..bc08310e9c 100644
--- a/player/main.c
+++ b/player/main.c
@@ -22,6 +22,7 @@
#include <assert.h>
#include <string.h>
#include <pthread.h>
+#include <signal.h>
#include "config.h"
#include "talloc.h"
@@ -489,6 +490,12 @@ int mp_initialize(struct MPContext *mpctx, char **options)
if (opts->w32_priority > 0)
SetPriorityClass(GetCurrentProcess(), opts->w32_priority);
#endif
+#ifndef _WIN32
+ // Deal with OpenSSL and GnuTLS not using MSG_NOSIGNAL.
+ struct sigaction sa = { .sa_handler = SIG_IGN, .sa_flags = SA_RESTART };
+ sigfillset(&sa.sa_mask);
+ sigaction(SIGPIPE, &sa, NULL);
+#endif
prepare_playlist(mpctx, mpctx->playlist);