aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorPhilip Gladstone <philipjsg@users.sourceforge.net>2003-09-29 01:41:30 +0000
committerPhilip Gladstone <philipjsg@users.sourceforge.net>2003-09-29 01:41:30 +0000
commit6c8e0d4d46d6173c9226ff92c5995ab8138f444e (patch)
treea07a4492c9de7934b9fe31b90633e14fb3695459 /libavformat/tcp.c
parent05ab0b76b701bc3f200571f2f3f266d11fbd3253 (diff)
downloadffmpeg-6c8e0d4d46d6173c9226ff92c5995ab8138f444e.tar.gz
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
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c10
1 files 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;
}