*/
#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
#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;
}