summaryrefslogtreecommitdiffstats
path: root/applypatch/applypatch.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-07-13 22:11:09 +0200
committerTao Bao <tbao@google.com>2018-07-20 20:26:17 +0200
commitd34e6bc44b0e58a3261cd7070a1525099932f205 (patch)
treeff7098efd4f91f323189d3a0fdf248df724bcfc1 /applypatch/applypatch.cpp
parentMerge "Fix the arguments passed to getopt_long(3)." (diff)
downloadandroid_bootable_recovery-d34e6bc44b0e58a3261cd7070a1525099932f205.tar
android_bootable_recovery-d34e6bc44b0e58a3261cd7070a1525099932f205.tar.gz
android_bootable_recovery-d34e6bc44b0e58a3261cd7070a1525099932f205.tar.bz2
android_bootable_recovery-d34e6bc44b0e58a3261cd7070a1525099932f205.tar.lz
android_bootable_recovery-d34e6bc44b0e58a3261cd7070a1525099932f205.tar.xz
android_bootable_recovery-d34e6bc44b0e58a3261cd7070a1525099932f205.tar.zst
android_bootable_recovery-d34e6bc44b0e58a3261cd7070a1525099932f205.zip
Diffstat (limited to 'applypatch/applypatch.cpp')
-rw-r--r--applypatch/applypatch.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 12e139930..b1aefa49b 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -495,19 +495,15 @@ int applypatch_flash(const char* source_filename, const char* target_filename,
return 1;
}
- std::string target_str(target_filename);
- std::vector<std::string> pieces = android::base::Split(target_str, ":");
- if (pieces.size() != 2 || pieces[0] != "EMMC") {
+ std::vector<std::string> pieces = android::base::Split(target_filename, ":");
+ if (pieces.size() != 4 || pieces[0] != "EMMC") {
LOG(ERROR) << "Invalid target name \"" << target_filename << "\"";
return 1;
}
// Load the target into the source_file object to see if already applied.
- pieces.push_back(std::to_string(target_size));
- pieces.push_back(target_sha1_str);
- std::string fullname = android::base::Join(pieces, ':');
FileContents source_file;
- if (LoadPartitionContents(fullname, &source_file) == 0 &&
+ if (LoadPartitionContents(target_filename, &source_file) == 0 &&
memcmp(source_file.sha1, target_sha1, SHA_DIGEST_LENGTH) == 0) {
// The early-exit case: the image was already applied, this partition has the desired hash,
// nothing for us to do.