summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-01-10 20:12:24 +0100
committerandroid-build-merger <android-build-merger@google.com>2017-01-10 20:12:24 +0100
commit7d345f27e7afee3840cf49f4f4ebe2eee8e3126a (patch)
tree83dfb19ae7cc08ef4193d411f418c07f8200ce11
parentMerge "Address review comment." am: 77ec0071cf (diff)
parentMerge "Do not inject I/O fault on a retry" (diff)
downloadandroid_bootable_recovery-7d345f27e7afee3840cf49f4f4ebe2eee8e3126a.tar
android_bootable_recovery-7d345f27e7afee3840cf49f4f4ebe2eee8e3126a.tar.gz
android_bootable_recovery-7d345f27e7afee3840cf49f4f4ebe2eee8e3126a.tar.bz2
android_bootable_recovery-7d345f27e7afee3840cf49f4f4ebe2eee8e3126a.tar.lz
android_bootable_recovery-7d345f27e7afee3840cf49f4f4ebe2eee8e3126a.tar.xz
android_bootable_recovery-7d345f27e7afee3840cf49f4f4ebe2eee8e3126a.tar.zst
android_bootable_recovery-7d345f27e7afee3840cf49f4f4ebe2eee8e3126a.zip
-rw-r--r--otafault/config.cpp6
-rw-r--r--otafault/config.h2
-rw-r--r--updater/updater.cpp2
3 files changed, 6 insertions, 4 deletions
diff --git a/otafault/config.cpp b/otafault/config.cpp
index ee4ef8911..8590833ee 100644
--- a/otafault/config.cpp
+++ b/otafault/config.cpp
@@ -29,21 +29,23 @@
#define OTAIO_MAX_FNAME_SIZE 128
static ZipArchiveHandle archive;
+static bool is_retry = false;
static std::map<std::string, bool> should_inject_cache;
static std::string get_type_path(const char* io_type) {
return android::base::StringPrintf("%s/%s", OTAIO_BASE_DIR, io_type);
}
-void ota_io_init(ZipArchiveHandle za) {
+void ota_io_init(ZipArchiveHandle za, bool retry) {
archive = za;
+ is_retry = retry;
ota_set_fault_files();
}
bool should_fault_inject(const char* io_type) {
// archive will be NULL if we used an entry point other
// than updater/updater.cpp:main
- if (archive == NULL) {
+ if (archive == nullptr || is_retry) {
return false;
}
const std::string type_path = get_type_path(io_type);
diff --git a/otafault/config.h b/otafault/config.h
index c048617c2..4adbdd121 100644
--- a/otafault/config.h
+++ b/otafault/config.h
@@ -52,7 +52,7 @@
/*
* Initialize libotafault by providing a reference to the OTA package.
*/
-void ota_io_init(ZipArchiveHandle zip);
+void ota_io_init(ZipArchiveHandle zip, bool retry);
/*
* Return true if a config file is present for the given IO type.
diff --git a/updater/updater.cpp b/updater/updater.cpp
index 3e624dae7..473066263 100644
--- a/updater/updater.cpp
+++ b/updater/updater.cpp
@@ -100,7 +100,6 @@ int main(int argc, char** argv) {
CloseArchive(za);
return 3;
}
- ota_io_init(za);
ZipString script_name(SCRIPT_NAME);
ZipEntry script_entry;
@@ -166,6 +165,7 @@ int main(int argc, char** argv) {
printf("unexpected argument: %s", argv[4]);
}
}
+ ota_io_init(za, state.is_retry);
std::string result;
bool status = Evaluate(&state, root, &result);