diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-16 05:16:27 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-16 05:16:27 +0000 |
commit | 70a1767a23b82f34e918a435a48be0784d11a23c (patch) | |
tree | 119bc5a8390aaeb3b03179154e19b15d92ec1a7c | |
parent | b97fa43167adbe195e5d5274fc57814bf788bf7e (diff) | |
parent | 5375bb9d70a577a1ee0d939ccbdffc6f6fde9b1e (diff) |
Snap for 8462842 from 5375bb9d70a577a1ee0d939ccbdffc6f6fde9b1e to tm-qpr1-release
Change-Id: I008147b7cadea190f90ca98f94330f1f81b1ee1e
-rw-r--r-- | aosp/ota_extractor.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/aosp/ota_extractor.cc b/aosp/ota_extractor.cc index 7492bc5a..4a57370f 100644 --- a/aosp/ota_extractor.cc +++ b/aosp/ota_extractor.cc @@ -118,15 +118,21 @@ bool ExtractImagesFromOTA(const DeltaArchiveManifest& manifest, << " size: " << partition.new_partition_info().size(); const auto output_path = output_dir_path.Append(partition.partition_name() + ".img").value(); - const auto input_path = - input_dir_path.Append(partition.partition_name() + ".img").value(); auto out_fd = std::make_shared<chromeos_update_engine::EintrSafeFileDescriptor>(); TEST_AND_RETURN_FALSE_ERRNO( out_fd->Open(output_path.c_str(), O_RDWR | O_CREAT, 0644)); auto in_fd = std::make_shared<chromeos_update_engine::EintrSafeFileDescriptor>(); - TEST_AND_RETURN_FALSE_ERRNO(in_fd->Open(input_path.c_str(), O_RDONLY)); + if (partition.has_old_partition_info()) { + const auto input_path = + input_dir_path.Append(partition.partition_name() + ".img").value(); + LOG(INFO) << "Incremental OTA detected for partition " + << partition.partition_name() << " opening source image " + << input_path; + CHECK(in_fd->Open(input_path.c_str(), O_RDONLY)) + << " failed to open " << input_path; + } for (const auto& op : partition.operations()) { if (op.has_src_sha256_hash()) { @@ -159,9 +165,11 @@ bool ExtractImagesFromOTA(const DeltaArchiveManifest& manifest, TEST_AND_RETURN_FALSE(executor.ExecuteReplaceOperation( op, std::move(direct_writer), blob.data(), blob.size())); } else if (op.type() == InstallOperation::SOURCE_COPY) { + CHECK(in_fd->IsOpen()); TEST_AND_RETURN_FALSE(executor.ExecuteSourceCopyOperation( op, std::move(direct_writer), in_fd)); } else { + CHECK(in_fd->IsOpen()); TEST_AND_RETURN_FALSE(executor.ExecuteDiffOperation( op, std::move(direct_writer), in_fd, blob.data(), blob.size())); } |