Must not call check_timeout() before checking the errno value.