Recover from EINTR or EAGAIN in select()