summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-12 22:54:11 +0200
committerwm4 <wm4@nowhere>2015-05-12 22:54:11 +0200
commit47d69f366b116b05edb7df546b0db0cc1ea50c17 (patch)
treeece0c57a5cb1f4e8bbd87abbca2c27d4bd1df3b3
parent29eb764fe0ae67bebfa930f88a9d7088f30561dd (diff)
downloadmpv-47d69f366b116b05edb7df546b0db0cc1ea50c17.tar.bz2
mpv-47d69f366b116b05edb7df546b0db0cc1ea50c17.tar.xz
ipc: avoid SIGPIPE
Until now, we just blocked SIGPIPE globally. Fix it properly to get away from it. MSG_NOSIGNAL should be widely available and is part of the POSIX.1-2008 standard. But it's not available on OSX, because Apple is both evil and retarded. Thus we continue to ignore the problem on such shitty systems.
-rw-r--r--input/ipc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/input/ipc.c b/input/ipc.c
index 05561ddd83..b49d64b8d4 100644
--- a/input/ipc.c
+++ b/input/ipc.c
@@ -43,6 +43,10 @@
#include "options/path.h"
#include "player/client.h"
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+
struct mp_ipc_ctx {
struct mp_log *log;
struct mp_client_api *client_api;
@@ -486,7 +490,7 @@ static int ipc_write_str(struct client_arg *client, const char *buf)
{
size_t count = strlen(buf);
while (count > 0) {
- ssize_t rc = write(client->client_fd, buf, count);
+ ssize_t rc = send(client->client_fd, buf, count, MSG_NOSIGNAL);
if (rc <= 0) {
if (rc == 0)
return -1;