From patchwork Mon Aug 13 19:30:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/3] http: pass return code from http_open_cnx_internal() on its failure X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 64327 Message-Id: <20180813193015.15253-1-martin@martin.st> To: libav-devel@libav.org Date: Mon, 13 Aug 2018 22:30:13 +0300 From: =?utf-8?q?Martin_Storsj=C3=B6?= List-Id: libav development From: Andrey Utkin Previously, AVERROR(EIO) was returned on failure of http_open_cnx_internal(). Now the value is passed to upper level, thus it is possible to distinguish ECONNREFUSED, ETIMEDOUT, ENETUNREACH etc. --- libavformat/http.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/http.c b/libavformat/http.c index 80c87f786a..dfb95642c0 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -248,6 +248,8 @@ fail: if (s->hd) ffurl_close(s->hd); s->hd = NULL; + if (location_changed < 0) + return location_changed; return AVERROR(EIO); } From patchwork Mon Aug 13 19:30:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/3] network: Use ff_neterrno instead of AVERROR(errno) for poll errors X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 64326 Message-Id: <20180813193015.15253-2-martin@martin.st> To: libav-devel@libav.org Date: Mon, 13 Aug 2018 22:30:14 +0300 From: =?utf-8?q?Martin_Storsj=C3=B6?= List-Id: libav development From: Simon Thelen This makes sure to pick up the actual error codes on windows. --- libavformat/network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/network.c b/libavformat/network.c index 86d79553f7..1e02668ecf 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -138,7 +138,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; } From patchwork Mon Aug 13 19:30:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/3] network: Check for EINTR in ff_poll_interrupt X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 64328 Message-Id: <20180813193015.15253-3-martin@martin.st> To: libav-devel@libav.org Date: Mon, 13 Aug 2018 22:30:15 +0300 From: =?utf-8?q?Martin_Storsj=C3=B6?= List-Id: libav development --- libavformat/network.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavformat/network.c b/libavformat/network.c index 1e02668ecf..24fcf20539 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -131,14 +131,17 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout, if (ff_check_interrupt(cb)) return AVERROR_EXIT; ret = poll(p, nfds, POLLING_TIME); - if (ret != 0) + if (ret != 0) { + if (ret < 0) + ret = ff_neterrno(); + if (ret == AVERROR(EINTR)) + continue; break; + } } while (timeout < 0 || runs-- > 0); if (!ret) return AVERROR(ETIMEDOUT); - if (ret < 0) - return ff_neterrno(); return ret; }