mirror of
https://github.com/DarrylNixon/melamine.git
synced 2024-04-22 06:27:20 -07:00
Fix indents causing file to close during shred
This commit is contained in:
parent
e69775471f
commit
2b20dc6cc8
1 changed files with 19 additions and 19 deletions
|
@ -103,27 +103,27 @@ class ShredFile(AsyncObject):
|
||||||
self.sha1 = sha1.digest()
|
self.sha1 = sha1.digest()
|
||||||
logger.info(f"Got hash {sha1.hexdigest()}")
|
logger.info(f"Got hash {sha1.hexdigest()}")
|
||||||
|
|
||||||
# First pass: Overwrite with binary zeroes
|
# First pass: Overwrite with binary zeroes
|
||||||
logger.info(f"[1/4] Writing zeroes ({self.absolute_path.name})")
|
logger.info(f"[1/4] Writing zeroes ({self.absolute_path.name})")
|
||||||
await file.seek(0)
|
await file.seek(0)
|
||||||
if not dryrun:
|
if not dryrun:
|
||||||
await file.write(b"\x00" * self.byte_size)
|
await file.write(b"\x00" * self.byte_size)
|
||||||
await file.flush()
|
await file.flush()
|
||||||
|
|
||||||
# Second pass: Overwrite with binary ones
|
# Second pass: Overwrite with binary ones
|
||||||
logger.info(f"[2/4] Writing ones ({self.absolute_path.name})")
|
logger.info(f"[2/4] Writing ones ({self.absolute_path.name})")
|
||||||
await file.seek(0)
|
await file.seek(0)
|
||||||
if not dryrun:
|
if not dryrun:
|
||||||
await file.write(b"\xff" * self.byte_size)
|
await file.write(b"\xff" * self.byte_size)
|
||||||
await file.flush()
|
await file.flush()
|
||||||
|
|
||||||
# Third pass: Overwrite with random data
|
# Third pass: Overwrite with random data
|
||||||
logger.info(f"[3/4] Writing randoms ({self.absolute_path.name})")
|
logger.info(f"[3/4] Writing randoms ({self.absolute_path.name})")
|
||||||
await file.seek(0)
|
await file.seek(0)
|
||||||
random_data = token_bytes(self.byte_size)
|
random_data = token_bytes(self.byte_size)
|
||||||
if not dryrun:
|
if not dryrun:
|
||||||
await file.write(random_data)
|
await file.write(random_data)
|
||||||
await file.flush()
|
await file.flush()
|
||||||
|
|
||||||
# Remove the file
|
# Remove the file
|
||||||
logger.info(f"[4/4] Unlinking {self.absolute_path}")
|
logger.info(f"[4/4] Unlinking {self.absolute_path}")
|
||||||
|
|
Loading…
Reference in a new issue