Retry read() if it returns EAGAIN or EINTR