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
This commit is contained in:
Philip Gladstone 2003-09-29 01:41:30 +00:00
parent 05ab0b76b7
commit 6c8e0d4d46
1 changed files with 7 additions and 3 deletions

View File

@ -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;
}