diff options
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2012-03-06 18:32:09 +0100 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2012-03-06 18:33:09 +0100 |
commit | df86df9ddf75aa97de126cd1833608284bafee18 (patch) | |
tree | 2119cf90b4a0adc2145d6b90563cc0b7b284bfa5 /gst | |
parent | 837763fee8b13d4f964e89b1de8bf4b7f3571836 (diff) |
dccp: avoid indefinite looping upon error
... and fix 'uninitialized' compilation warning as well.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/dccp/gstdccp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gst/dccp/gstdccp.c b/gst/dccp/gstdccp.c index 8a80db416..cbe7c4689 100644 --- a/gst/dccp/gstdccp.c +++ b/gst/dccp/gstdccp.c @@ -333,7 +333,7 @@ gst_dccp_socket_write (GstElement * element, int socket, const void *buf, size_t size, int packet_size) { size_t bytes_written = 0; - ssize_t wrote; + ssize_t wrote = 0; #ifndef G_OS_WIN32 struct iovec iov; @@ -362,8 +362,11 @@ gst_dccp_socket_write (GstElement * element, int socket, const void *buf, } while (wrote == SOCKET_ERROR && errorCode == EAGAIN); #endif - /* TODO print the send error */ - bytes_written += wrote; + /* give up on error */ + if (wrote >= 0) + bytes_written += wrote; + else + break; } if (wrote < 0) |