From a389cc760aebc621bfc4016f6393d0ce2381d2d1 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 17 Oct 2019 22:49:57 +0200 Subject: [PATCH] Fix a stacktrace in ./mat2 when the file can't be cleaned --- mat2 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mat2 b/mat2 index 01b834b..ec09637 100755 --- a/mat2 +++ b/mat2 @@ -137,9 +137,10 @@ def clean_meta(filename: str, is_lightweight: bool, inplace: bool, sandbox: bool try: logging.debug('Cleaning %s…', filename) ret = p.remove_all() - shutil.copymode(filename, p.output_filename) - if inplace is True: - os.rename(p.output_filename, filename) + if ret is True: + shutil.copymode(filename, p.output_filename) + if inplace is True: + os.rename(p.output_filename, filename) return ret except RuntimeError as e: print("[-] %s can't be cleaned: %s" % (filename, e))