Bugfix:updater always retry apply patch failed,when memcpy failed.

https://code.google.com/p/android/issues/detail?id=230602
On the second attempt, open the file with O_RDONLY,
which causing a write failure。

Change-Id: If89165b8c7619fe25722073a46b3cc7c61530a71
Signed-off-by: katao <ustckato@gmail.com>
This commit is contained in:
katao
2016-12-19 11:22:30 +08:00
committed by tao ka
parent 26d972c9d2
commit 9a6f520419

View File

@@ -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) {