summaryrefslogtreecommitdiff
path: root/payload_generator/deflate_utils.cc
diff options
context:
space:
mode:
authorAmin Hassani <ahassani@chromium.org>2020-09-16 11:19:28 -0700
committerAmin Hassani <ahassani@chromium.org>2020-09-17 10:17:36 -0700
commite53b39b8b9c5c0871841bbbb86f23657c0b7f91b (patch)
tree12746e5e7e4716ba7fc94d3ed5c1a36c4d47d474 /payload_generator/deflate_utils.cc
parenta02a1f1dc837f22226499d9856a949fb180d099a (diff)
parent9956320ffa4edb340d20bd7f3c852a9e87437bd3 (diff)
update_engine: Merge remote-tracking branch 'cros/upstream' into cros/master
Done with: git merge cros/upstream --commit -s recursive - Added EC key support and its unittests. - Resolved a conlict on error codes. Since Android versions are not uploading any UMA metrics, I gave the priority to the Android version Since they can't be changed. - Changed the openssl functions to get1 version (from get0) version because of a current issue with gale. Once the issue is resolved we need to change them back. - Some remaining styling issues fixed by clang-format BUG=b:163153182 TEST=CQ passes TEST=unittests Change-Id: Ib95034422b92433ce26e28336bc4806b34910d38
Diffstat (limited to 'payload_generator/deflate_utils.cc')
-rw-r--r--payload_generator/deflate_utils.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/payload_generator/deflate_utils.cc b/payload_generator/deflate_utils.cc
index 5d7a766a..c874bfd2 100644
--- a/payload_generator/deflate_utils.cc
+++ b/payload_generator/deflate_utils.cc
@@ -74,6 +74,15 @@ bool IsSquashfsImage(const string& part_path,
return false;
}
+bool IsRegularFile(const FilesystemInterface::File& file) {
+ // If inode is 0, then stat information is invalid for some psuedo files
+ if (file.file_stat.st_ino != 0 &&
+ (file.file_stat.st_mode & S_IFMT) == S_IFREG) {
+ return true;
+ }
+ return false;
+}
+
// Realigns subfiles |files| of a splitted file |file| into its correct
// positions. This can be used for squashfs, zip, apk, etc.
bool RealignSplittedFiles(const FilesystemInterface::File& file,
@@ -265,7 +274,9 @@ bool PreprocessPartitionFiles(const PartitionConfig& part,
result_files->reserve(tmp_files.size());
for (auto& file : tmp_files) {
- if (IsSquashfsImage(part.path, file)) {
+ auto is_regular_file = IsRegularFile(file);
+
+ if (is_regular_file && IsSquashfsImage(part.path, file)) {
// Read the image into a file.
base::FilePath path;
TEST_AND_RETURN_FALSE(base::CreateTemporaryFile(&path));
@@ -296,7 +307,7 @@ bool PreprocessPartitionFiles(const PartitionConfig& part,
}
}
- if (extract_deflates && !file.is_compressed) {
+ if (is_regular_file && extract_deflates && !file.is_compressed) {
// Search for deflates if the file is in zip or gzip format.
// .zvoice files may eventually move out of rootfs. If that happens,
// remove ".zvoice" (crbug.com/782918).