Problem: waiting on an empty poller with infinite timeout waits forever

Solution: return EFAULT when such an operation is attempted
This commit is contained in:
sigiesec
2017-08-22 18:36:11 +02:00
parent 0c9b16d62a
commit c1a4cfdd9f
2 changed files with 9 additions and 8 deletions

View File

@@ -400,6 +400,11 @@ int zmq::socket_poller_t::rebuild ()
int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *events_, int n_events_, long timeout_)
{
if (items.empty () && timeout_ < 0) {
errno = EFAULT;
return -1;
}
if (need_rebuild)
if (rebuild () == -1)
return -1;