mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
29eb764fe0
commit
47d69f366b
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue