[3/3] network: Check for EINTR in ff_poll_interrupt

Message ID 20180813193015.15253-3-martin@martin.st
State Committed
Commit 22f98ac19cf29f22b3e1d10314df9503f06fe683
Headers show
Series
  • [1/3] http: pass return code from http_open_cnx_internal() on its failure
Related show

Commit Message

Martin Storsjö Aug. 13, 2018, 7:30 p.m.
---
 libavformat/network.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch

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;
 }