* commit '6ee1cb5740e7490151db7dcec7e20ceaf8a2fe1f': libavformat: use MSG_NOSIGNAL when applicable
Unified · Split
| @@ -111,6 +111,10 @@ struct sockaddr_storage { · 110 unmodified lines | ||
| 111 | 111 | }; |
| 112 | 112 | #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ |
| 113 | 113 | |
| 114 | +#ifndef MSG_NOSIGNAL | |
| 115 | +#define MSG_NOSIGNAL 0 | |
| 116 | +#endif | |
| 117 | + | |
| 114 | 118 | #if !HAVE_STRUCT_ADDRINFO |
| 115 | 119 | struct addrinfo { |
| 116 | 120 | int ai_flags; |
| @@ -143,7 +143,7 @@ static int ff_sctp_send(int s, const void *msg, size_t len, · 142 unmodified lines | ||
| 143 | 143 | memcpy(CMSG_DATA(cmsg), sinfo, sizeof(struct sctp_sndrcvinfo)); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | − return sendmsg(s, &outmsg, flags); | |
| 146 | + return sendmsg(s, &outmsg, flags | MSG_NOSIGNAL); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | typedef struct SCTPContext { |
| @@ -302,7 +302,7 @@ static int sctp_write(URLContext *h, const uint8_t *buf, int size) · 152 unmodified lines | ||
| 302 | 302 | } |
| 303 | 303 | ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR); |
| 304 | 304 | } else |
| 305 | − ret = send(s->fd, buf, size, 0); | |
| 305 | + ret = send(s->fd, buf, size, MSG_NOSIGNAL); | |
| 306 | 306 | |
| 307 | 307 | return ret < 0 ? ff_neterrno() : ret; |
| 308 | 308 | } |
| @@ -186,7 +186,7 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size) · 185 unmodified lines | ||
| 186 | 186 | if (ret) |
| 187 | 187 | return ret; |
| 188 | 188 | } |
| 189 | − ret = send(s->fd, buf, size, 0); | |
| 189 | + ret = send(s->fd, buf, size, MSG_NOSIGNAL); | |
| 190 | 190 | return ret < 0 ? ff_neterrno() : ret; |
| 191 | 191 | } |
| 192 | 192 | |
| @@ -123,7 +123,7 @@ static int unix_write(URLContext *h, const uint8_t *buf, int size) · 122 unmodified lines | ||
| 123 | 123 | if (ret < 0) |
| 124 | 124 | return ret; |
| 125 | 125 | } |
| 126 | − ret = send(s->fd, buf, size, 0); | |
| 126 | + ret = send(s->fd, buf, size, MSG_NOSIGNAL); | |
| 127 | 127 | return ret < 0 ? ff_neterrno() : ret; |
| 128 | 128 | } |
| 129 | 129 | |