From 6c8e0d4d46d6173c9226ff92c5995ab8138f444e Mon Sep 17 00:00:00 2001 From: Philip Gladstone Date: Mon, 29 Sep 2003 01:41:30 +0000 Subject: [PATCH] Fix a very nasty problem with extra bytes appearing in TCP data streams. Whenever there was an EINTR/EAGAIN return, then a byte in the data stream would be duplicated!! This fix should allow ffserver to work again. Originally committed as revision 2317 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/tcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index d280815714..7638b95d92 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -200,12 +200,16 @@ static int tcp_write(URLContext *h, uint8_t *buf, int size) #else ret = write(s->fd, buf, size); #endif - if (ret < 0 && errno != EINTR && errno != EAGAIN) + if (ret < 0) { + if (errno != EINTR && errno != EAGAIN) { #ifdef __BEOS__ - return errno; + return errno; #else - return -errno; + return -errno; #endif + } + continue; + } size -= ret; buf += ret; }