diff --git a/libavformat/network.h b/libavformat/network.h index 9d8c92fb835a0781dc7309d5687459d2fd72842a..09cee58a5ca8fe76a1d456f7b671eb559d01b970 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -98,6 +98,10 @@ struct sockaddr_storage { }; #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + #if !HAVE_STRUCT_ADDRINFO struct addrinfo { int ai_flags; diff --git a/libavformat/sctp.c b/libavformat/sctp.c index 66b31ccec691804f8e027aeb30551d8364e676fb..84a4ac19380df96f473b63a43968636cd24fd97c 100644 --- a/libavformat/sctp.c +++ b/libavformat/sctp.c @@ -143,7 +143,7 @@ static int ff_sctp_send(int s, const void *msg, size_t len, memcpy(CMSG_DATA(cmsg), sinfo, sizeof(struct sctp_sndrcvinfo)); } - return sendmsg(s, &outmsg, flags); + return sendmsg(s, &outmsg, flags | MSG_NOSIGNAL); } typedef struct SCTPContext { @@ -300,7 +300,7 @@ static int sctp_write(URLContext *h, const uint8_t *buf, int size) abort(); ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR); } else - ret = send(s->fd, buf, size, 0); + ret = send(s->fd, buf, size, MSG_NOSIGNAL); return ret < 0 ? ff_neterrno() : ret; } diff --git a/libavformat/tcp.c b/libavformat/tcp.c index cbd51422a8c8616eea2fc4b7aa9892a721cf094e..27a01845c59aeda42a8dc76da9376ec147e63f11 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -154,7 +154,7 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size) if (ret < 0) return ret; } - ret = send(s->fd, buf, size, 0); + ret = send(s->fd, buf, size, MSG_NOSIGNAL); return ret < 0 ? ff_neterrno() : ret; } diff --git a/libavformat/unix.c b/libavformat/unix.c index ab57c681953c294c9480fa48bbbd72c7615f1956..5c6f576487bc0715913f4366a7c5934305dd4915 100644 --- a/libavformat/unix.c +++ b/libavformat/unix.c @@ -124,7 +124,7 @@ static int unix_write(URLContext *h, const uint8_t *buf, int size) if (ret < 0) return ret; } - ret = send(s->fd, buf, size, 0); + ret = send(s->fd, buf, size, MSG_NOSIGNAL); return ret < 0 ? ff_neterrno() : ret; }