OSDN Git Service

libavformat/tcp: fix return code for tcp_accept
authorSimon Thelen <ffmpeg-dev@c-14.de>
Sat, 8 Apr 2017 12:21:28 +0000 (14:21 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 10 May 2017 12:00:20 +0000 (14:00 +0200)
ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or
undefined), return ret instead and return ff_neterror() in
ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on
Windows.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/network.c
libavformat/tcp.c

index 2fb1c8b..b3987a4 100644 (file)
@@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout,
     if (!ret)
         return AVERROR(ETIMEDOUT);
     if (ret < 0)
-        return AVERROR(errno);
+        return ff_neterrno();
     return ret;
 }
 
index 3055e48..07b4ed9 100644 (file)
@@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c)
     cc = (*c)->priv_data;
     ret = ff_accept(sc->fd, sc->listen_timeout, s);
     if (ret < 0)
-        return ff_neterrno();
+        return ret;
     cc->fd = ret;
     return 0;
 }