diff options
Diffstat (limited to 'scripts/update_payload/applier.py')
-rw-r--r-- | scripts/update_payload/applier.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/update_payload/applier.py b/scripts/update_payload/applier.py index 52a70f91..85f8b0eb 100644 --- a/scripts/update_payload/applier.py +++ b/scripts/update_payload/applier.py @@ -424,15 +424,15 @@ class PayloadApplier(object): _VerifySha256(old_part_file, old_part_info.hash, part_name, length=old_part_info.size) - # Copy the src partition to the dst one. + # Copy the src partition to the dst one; make sure we don't truncate it. shutil.copyfile(old_part_file_name, new_part_file_name) + new_part_file_mode = 'r+b' else: - # Preallocate the dst partition file. - subprocess.check_call( - ['fallocate', '-l', str(new_part_info.size), new_part_file_name]) + # We need to create/truncate the dst partition file. + new_part_file_mode = 'w+b' # Apply operations. - with open(new_part_file_name, 'r+b') as new_part_file: + with open(new_part_file_name, new_part_file_mode) as new_part_file: self._ApplyOperations(operations, base_name, new_part_file, new_part_info.size) # Truncate the result, if so instructed. |