Loading fs_mgr/liblp/images.cpp +6 −12 Original line number Original line Diff line number Diff line Loading @@ -299,7 +299,7 @@ bool SparseBuilder::AddPartitionImage(const LpMetadataPartition& partition, uint64_t partition_size = ComputePartitionSize(partition); uint64_t partition_size = ComputePartitionSize(partition); if (file_length > partition_size) { if (file_length > partition_size) { LERROR << "Image for partition '" << GetPartitionName(partition) LERROR << "Image for partition '" << GetPartitionName(partition) << "' is greater than its size (" << file_length << ", excepted " << partition_size << "' is greater than its size (" << file_length << ", expected " << partition_size << ")"; << ")"; return false; return false; } } Loading Loading @@ -419,25 +419,19 @@ int SparseBuilder::OpenImageFile(const std::string& file) { return fd; return fd; } } char temp_file[PATH_MAX]; TemporaryFile tf; snprintf(temp_file, sizeof(temp_file), "%s/imageXXXXXX", P_tmpdir); if (tf.fd < 0) { android::base::unique_fd temp_fd(mkstemp(temp_file)); PERROR << "make temporary file failed"; if (temp_fd < 0) { PERROR << "mkstemp failed"; return -1; } if (unlink(temp_file) < 0) { PERROR << "unlink failed"; return -1; return -1; } } // We temporarily unsparse the file, rather than try to merge its chunks. // We temporarily unsparse the file, rather than try to merge its chunks. int rv = sparse_file_write(source.get(), temp_fd, false, false, false); int rv = sparse_file_write(source.get(), tf.fd, false, false, false); if (rv) { if (rv) { LERROR << "sparse_file_write failed with code: " << rv; LERROR << "sparse_file_write failed with code: " << rv; return -1; return -1; } } temp_fds_.push_back(std::move(temp_fd)); temp_fds_.push_back(android::base::unique_fd(tf.release())); return temp_fds_.back().get(); return temp_fds_.back().get(); } } Loading Loading
fs_mgr/liblp/images.cpp +6 −12 Original line number Original line Diff line number Diff line Loading @@ -299,7 +299,7 @@ bool SparseBuilder::AddPartitionImage(const LpMetadataPartition& partition, uint64_t partition_size = ComputePartitionSize(partition); uint64_t partition_size = ComputePartitionSize(partition); if (file_length > partition_size) { if (file_length > partition_size) { LERROR << "Image for partition '" << GetPartitionName(partition) LERROR << "Image for partition '" << GetPartitionName(partition) << "' is greater than its size (" << file_length << ", excepted " << partition_size << "' is greater than its size (" << file_length << ", expected " << partition_size << ")"; << ")"; return false; return false; } } Loading Loading @@ -419,25 +419,19 @@ int SparseBuilder::OpenImageFile(const std::string& file) { return fd; return fd; } } char temp_file[PATH_MAX]; TemporaryFile tf; snprintf(temp_file, sizeof(temp_file), "%s/imageXXXXXX", P_tmpdir); if (tf.fd < 0) { android::base::unique_fd temp_fd(mkstemp(temp_file)); PERROR << "make temporary file failed"; if (temp_fd < 0) { PERROR << "mkstemp failed"; return -1; } if (unlink(temp_file) < 0) { PERROR << "unlink failed"; return -1; return -1; } } // We temporarily unsparse the file, rather than try to merge its chunks. // We temporarily unsparse the file, rather than try to merge its chunks. int rv = sparse_file_write(source.get(), temp_fd, false, false, false); int rv = sparse_file_write(source.get(), tf.fd, false, false, false); if (rv) { if (rv) { LERROR << "sparse_file_write failed with code: " << rv; LERROR << "sparse_file_write failed with code: " << rv; return -1; return -1; } } temp_fds_.push_back(std::move(temp_fd)); temp_fds_.push_back(android::base::unique_fd(tf.release())); return temp_fds_.back().get(); return temp_fds_.back().get(); } } Loading