Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 9e1c3ce

Browse files
committed
VirtualDisk: Fix error message referencing variable before assign.
1 parent 9b62a05 commit 9e1c3ce

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

virtinst/VirtualDisk.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,11 +838,13 @@ def _clone_local(self, meter, size_bytes):
838838
if (os.path.exists(self.path) == False and self.sparse == True):
839839
clone_block_size = 4096
840840
sparse = True
841+
fd = None
841842
try:
842843
fd = os.open(self.path, os.O_WRONLY | os.O_CREAT)
843844
os.ftruncate(fd, size_bytes)
844845
finally:
845-
os.close(fd)
846+
if fd:
847+
os.close(fd)
846848
else:
847849
clone_block_size = 1024*1024*10
848850
sparse = False

0 commit comments

Comments
 (0)