[FFmpeg-cvslog] network: Check POLLERR and POLLHUP in ff_network_wait_fd

Gil Pedersen git at videolan.org
Fri Apr 29 04:38:02 CEST 2011


ffmpeg | branch: master | Gil Pedersen <gil at cmi.aau.dk> | Thu Apr 28 10:27:40 2011 +0300| [f2c85458c411447f006f9c928cb198ec0260255a] | committer: Martin Storsjö

network: Check POLLERR and POLLHUP in ff_network_wait_fd

Previously, the function would lead to an infinite wait (by
returning AVERROR(EAGAIN)) on sockets indicating an error
via either of these poll flags.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2c85458c411447f006f9c928cb198ec0260255a
---

 libavformat/network.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/network.h b/libavformat/network.h
index 84a8f53..881384c 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -78,7 +78,7 @@ static inline int ff_network_wait_fd(int fd, int write)
     struct pollfd p = { .fd = fd, .events = ev, .revents = 0 };
     int ret;
     ret = poll(&p, 1, 100);
-    return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : AVERROR(EAGAIN);
+    return ret < 0 ? ff_neterrno() : p.revents & (ev | POLLERR | POLLHUP) ? 0 : AVERROR(EAGAIN);
 }
 
 static inline void ff_network_close(void)



More information about the ffmpeg-cvslog mailing list