]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/tcp.c
* providing MPEG codecs with a generic fields in AVFrame to use.
[ffmpeg] / libavformat / tcp.c
index d4b81c88e99310d3ac97434d742b26d46724b5f0..7638b95d922734612fb1a8f6a495a450d1490594 100644 (file)
  */
 #include "avformat.h"
 #include <unistd.h>
-#include <ctype.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#if defined(__APPLE__) || defined(__BEOS__)
+typedef int socklen_t;
+#endif
 #ifndef __BEOS__
 # include <arpa/inet.h>
 #else
@@ -198,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;
     }