Fix potential error on POLLHUP or POLLERR events