diff options
author | Sreerenj B <bsreerenj@gmail.com> | 2009-11-13 11:16:44 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-11-13 11:18:46 +0100 |
commit | f3b3dd33f3cfe9d53412a326884c3f2ce9363f68 (patch) | |
tree | 57d7fc2b13b25f59bbdd6cf769b08aa819898417 | |
parent | 18f5fad78593b03ac0d3ef100723f355d032dfdb (diff) |
rtsp: avoid crashing on SIGPIPE
Use send() instead of write() so that we can pass the MSG_NOSIGNAL flags to
avoid crashing with SIGPIPE when the remote end is not listening to us anymore.
Fixes #601772
-rw-r--r-- | gst-libs/gst/rtsp/gstrtspconnection.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index 19202a2c9..c78da0b1c 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -114,9 +114,15 @@ typedef struct guint coutl; } DecodeCtx; +#ifdef MSG_NOSIGNAL +#define SEND_FLAGS MSG_NOSIGNAL +#else +#define SEND_FLAGS 0 +#endif + #ifdef G_OS_WIN32 #define READ_SOCKET(fd, buf, len) recv (fd, (char *)buf, len, 0) -#define WRITE_SOCKET(fd, buf, len) send (fd, (const char *)buf, len, 0) +#define WRITE_SOCKET(fd, buf, len) send (fd, (const char *)buf, len, SEND_FLAGS) #define SETSOCKOPT(sock, level, name, val, len) setsockopt (sock, level, name, (const char *)val, len) #define CLOSE_SOCKET(sock) closesocket (sock) #define ERRNO_IS_EAGAIN (WSAGetLastError () == WSAEWOULDBLOCK) @@ -126,7 +132,7 @@ typedef struct #define ERRNO_IS_EINPROGRESS (WSAGetLastError () == WSAEWOULDBLOCK) #else #define READ_SOCKET(fd, buf, len) read (fd, buf, len) -#define WRITE_SOCKET(fd, buf, len) write (fd, buf, len) +#define WRITE_SOCKET(fd, buf, len) send (fd, buf, len, SEND_FLAGS) #define SETSOCKOPT(sock, level, name, val, len) setsockopt (sock, level, name, val, len) #define CLOSE_SOCKET(sock) close (sock) #define ERRNO_IS_EAGAIN (errno == EAGAIN) |