diff options
author | Maxim Devaev <[email protected]> | 2024-10-29 19:50:27 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-10-29 19:50:27 +0200 |
commit | 47778bc48c41af82445eb7c0f25b48e91292886b (patch) | |
tree | c2120c671e8bb9750a8552126f59f6aded807be4 /kvmd/plugins | |
parent | c02bc53bc400dfe43d9eec84fc26cc4ce31ebb7a (diff) |
msd: ftruncate() for uploading
Diffstat (limited to 'kvmd/plugins')
-rw-r--r-- | kvmd/plugins/msd/__init__.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kvmd/plugins/msd/__init__.py b/kvmd/plugins/msd/__init__.py index 8b5fa8e2..193b81b1 100644 --- a/kvmd/plugins/msd/__init__.py +++ b/kvmd/plugins/msd/__init__.py @@ -271,6 +271,7 @@ class MsdFileWriter(BaseMsdWriter): # pylint: disable=too-many-instance-attribu get_logger(1).info("Writing %r image (%d bytes) to MSD ...", self.__name, self.__file_size) await aiofiles.os.makedirs(os.path.dirname(self.__path), exist_ok=True) self.__file = await aiofiles.open(self.__path, mode="w+b", buffering=0) # type: ignore + await aiotools.run_async(os.ftruncate, self.__file.fileno(), self.__file_size) # type: ignore return self async def finish(self) -> bool: |