1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-05 18:31:10 +01:00

#N/A: Fix mmap log cleanup

This commit is contained in:
Vladimir Iakovlev 2018-03-19 22:41:38 +01:00
parent 1508ecfeae
commit 4c9099a79b

View File

@ -16,9 +16,11 @@ def _read(f, fd):
try:
f.write(data)
except ValueError:
f.move(0, const.LOG_SIZE_TO_CLEAN,
const.LOG_SIZE_IN_BYTES - const.LOG_SIZE_TO_CLEAN)
f.seek(const.LOG_SIZE_IN_BYTES - const.LOG_SIZE_TO_CLEAN)
position = const.LOG_SIZE_IN_BYTES - const.LOG_SIZE_TO_CLEAN
f.move(0, const.LOG_SIZE_TO_CLEAN, position)
f.seek(position)
f.write(b'\x00' * const.LOG_SIZE_TO_CLEAN)
f.seek(position)
return data