summaryrefslogtreecommitdiff
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2007-04-27 00:35:54 +0000
committerAlex Beregszaszi <alex@rtfs.hu>2007-04-27 00:35:54 +0000
commit8da4034f529f3c5dcc3f95a7d81032cc9be543fb (patch)
treedc3e28a55483f023bb7c13d27630f58830a4af02 /libavformat/tcp.c
parent0bdacf29d40b11cfd5dd0d13577a4bdc90afdcea (diff)
use ff_neterrno() and FF_NETERROR() for networking error handling
Originally committed as revision 8845 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 40aba66a2d..b2f6d37a76 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -68,9 +68,9 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
ret = connect(fd, (struct sockaddr *)&dest_addr,
sizeof(dest_addr));
if (ret < 0) {
- if (errno == EINTR)
+ if (ff_neterrno() == FF_NETERROR(EINTR))
goto redo;
- if (errno != EINPROGRESS)
+ if (ff_neterrno() != FF_NETERROR(EINPROGRESS))
goto fail;
/* wait until we are connected or until abort */
@@ -126,7 +126,8 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size)
if (ret > 0 && FD_ISSET(s->fd, &rfds)) {
len = recv(s->fd, buf, size, 0);
if (len < 0) {
- if (errno != EINTR && errno != EAGAIN)
+ if (ff_neterrno() != FF_NETERROR(EINTR) &&
+ ff_neterrno() != FF_NETERROR(EAGAIN))
return AVERROR(errno);
} else return len;
} else if (ret < 0) {
@@ -155,7 +156,8 @@ static int tcp_write(URLContext *h, uint8_t *buf, int size)
if (ret > 0 && FD_ISSET(s->fd, &wfds)) {
len = send(s->fd, buf, size, 0);
if (len < 0) {
- if (errno != EINTR && errno != EAGAIN)
+ if (ff_neterrno() != FF_NETERROR(EINTR) &&
+ ff_neterrno() != FF_NETERROR(EAGAIN))
return AVERROR(errno);
continue;
}