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@martin.st>
This commit is contained in:
Gil Pedersen 2011-04-28 10:27:40 +03:00 committed by Martin Storsjö
parent f8fec05052
commit f2c85458c4

View File

@ -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)