From 2b20dc6cc87cbe43bc8568a6ca5535198415280c Mon Sep 17 00:00:00 2001 From: Darryl Nixon Date: Sun, 16 Jul 2023 11:29:46 -0700 Subject: [PATCH] Fix indents causing file to close during shred --- melamine/classes.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/melamine/classes.py b/melamine/classes.py index b4ab46a..950232b 100644 --- a/melamine/classes.py +++ b/melamine/classes.py @@ -103,27 +103,27 @@ class ShredFile(AsyncObject): self.sha1 = sha1.digest() logger.info(f"Got hash {sha1.hexdigest()}") - # First pass: Overwrite with binary zeroes - logger.info(f"[1/4] Writing zeroes ({self.absolute_path.name})") - await file.seek(0) - if not dryrun: - await file.write(b"\x00" * self.byte_size) - await file.flush() + # First pass: Overwrite with binary zeroes + logger.info(f"[1/4] Writing zeroes ({self.absolute_path.name})") + await file.seek(0) + if not dryrun: + await file.write(b"\x00" * self.byte_size) + await file.flush() - # Second pass: Overwrite with binary ones - logger.info(f"[2/4] Writing ones ({self.absolute_path.name})") - await file.seek(0) - if not dryrun: - await file.write(b"\xff" * self.byte_size) - await file.flush() + # Second pass: Overwrite with binary ones + logger.info(f"[2/4] Writing ones ({self.absolute_path.name})") + await file.seek(0) + if not dryrun: + await file.write(b"\xff" * self.byte_size) + await file.flush() - # Third pass: Overwrite with random data - logger.info(f"[3/4] Writing randoms ({self.absolute_path.name})") - await file.seek(0) - random_data = token_bytes(self.byte_size) - if not dryrun: - await file.write(random_data) - await file.flush() + # Third pass: Overwrite with random data + logger.info(f"[3/4] Writing randoms ({self.absolute_path.name})") + await file.seek(0) + random_data = token_bytes(self.byte_size) + if not dryrun: + await file.write(random_data) + await file.flush() # Remove the file logger.info(f"[4/4] Unlinking {self.absolute_path}")