summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkatao <ustckato@gmail.com>2016-12-19 04:22:30 +0100
committertao ka <ustckato@gmail.com>2016-12-19 09:51:07 +0100
commit9a6f5204190cda6bb6aecb59dff0293cc90ab0b7 (patch)
tree567c1e301e3e40486e427a0ce6bd9d02cd21f957
parentMerge "Add update_bootloader_message() to fix two-step OTAs." (diff)
downloadandroid_bootable_recovery-9a6f5204190cda6bb6aecb59dff0293cc90ab0b7.tar
android_bootable_recovery-9a6f5204190cda6bb6aecb59dff0293cc90ab0b7.tar.gz
android_bootable_recovery-9a6f5204190cda6bb6aecb59dff0293cc90ab0b7.tar.bz2
android_bootable_recovery-9a6f5204190cda6bb6aecb59dff0293cc90ab0b7.tar.lz
android_bootable_recovery-9a6f5204190cda6bb6aecb59dff0293cc90ab0b7.tar.xz
android_bootable_recovery-9a6f5204190cda6bb6aecb59dff0293cc90ab0b7.tar.zst
android_bootable_recovery-9a6f5204190cda6bb6aecb59dff0293cc90ab0b7.zip
-rw-r--r--applypatch/applypatch.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 95389da6e..8682e128b 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -332,6 +332,17 @@ int WriteToPartition(const unsigned char* data, size_t len, const std::string& t
success = true;
break;
}
+
+ if (ota_close(fd) != 0) {
+ printf("failed to close %s: %s\n", partition, strerror(errno));
+ return -1;
+ }
+
+ fd.reset(ota_open(partition, O_RDWR));
+ if (fd == -1) {
+ printf("failed to reopen %s for retry write && verify: %s\n", partition, strerror(errno));
+ return -1;
+ }
}
if (!success) {