update_engine: Kiosk version test and comment
The required Chrome OS version (target version prefix) variable for
kiosks is set to an empty string instead of a null pointer after 5
failed retrieval attempts. Omaha treats an empty target version prefix
the same as no target version prefix. This resulted in kiosks updating
to versions greater than their set version prefix would allow.
Document that an empty string as result means the version could not be
read and add a test for this behavior.
The behavior for empty kiosk version is changed in crrev.com/c/2416628.
BUG=chromium:1084453
TEST=FEATURES=test emerge-amd64-generic update_engine
Change-Id: Ia121882a9d1099e63ae87705b082cb25eaacc14a
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2218314
Tested-by: Miriam Polzer <mpolzer@google.com>
Commit-Queue: Miriam Polzer <mpolzer@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/update_manager/real_system_provider.cc b/update_manager/real_system_provider.cc
index a900071..39eba22 100644
--- a/update_manager/real_system_provider.cc
+++ b/update_manager/real_system_provider.cc
@@ -64,9 +64,10 @@
std::unique_ptr<T> result(new T());
if (!func_.Run(result.get())) {
if (failed_attempts_ >= kRetryPollVariableMaxRetry) {
- // Give up on the retries, set back the desired polling interval and
- // return the default.
+ // Give up on the retries and set back the desired polling interval.
this->SetPollInterval(base_interval_);
+ // Release the result instead of returning a |nullptr| to indicate that
+ // the result could not be fetched.
return result.release();
}
this->SetPollInterval(