changeset 261:5f27f90ed496 libavformat

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.
author philipjsg
date Mon, 29 Sep 2003 01:41:30 +0000
parents f3b8a6e60e71
children f174d9c00bce
files tcp.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tcp.c	Sun Sep 28 22:53:25 2003 +0000
+++ b/tcp.c	Mon Sep 29 01:41:30 2003 +0000
@@ -200,12 +200,16 @@
 #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;
     }