From 47d69f366b116b05edb7df546b0db0cc1ea50c17 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 12 May 2015 22:54:11 +0200 Subject: [PATCH] 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. --- input/ipc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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;