Commit f2c85458 authored by Gil Pedersen's avatar Gil Pedersen Committed by 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: 's avatarMartin Storsjö <martin@martin.st>
parent f8fec050
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment