From 72787d5c24aedfa876ecd5725f1ca4338d6ce020 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 4 Jan 2020 18:42:55 -0700 Subject: [PATCH] Fix destination checks when imaging --- scripts/wk/hw/ddrescue.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/wk/hw/ddrescue.py b/scripts/wk/hw/ddrescue.py index 9695a715..abd63955 100644 --- a/scripts/wk/hw/ddrescue.py +++ b/scripts/wk/hw/ddrescue.py @@ -139,6 +139,7 @@ class BlockPair(): # Imaging self.map_path = pathlib.Path(f'{destination}/Image_{map_name}.map') self.destination = self.map_path.with_suffix('.dd') + self.destination.touch() else: # Cloning self.map_path = pathlib.Path(f'{working_dir}/Clone_{map_name}.map') @@ -235,8 +236,8 @@ class BlockPair(): dest_size = dest_obj.details['size'] del dest_obj - # Raise exception if necessary - if dest_size < self.size: + # Check destination size if cloning + if not self.destination.is_file() and dest_size < self.size: std.print_error(f'Invalid destination: {self.destination}') raise std.GenericAbort()