Fix async yield with some try/finally

This commit is contained in:
Darryl Nixon 2023-07-16 09:38:40 -07:00
parent ab6eda59c2
commit bcc9c70322

View file

@ -59,20 +59,16 @@ class EXT23Handler:
inode = path.stat().st_ino
fs = ext2_filsys()
ret = self.libext2fs.ext2fs_open(path.encode(), 0, 0, 0, ctypes.byref(fs))
if ret != 0:
return []
if self.libext2fs.ext2fs_open(path.encode(), 0, 0, 0, ctypes.byref(fs)) == 0:
try:
scan = ext2_inode_scan()
ret = self.libext2fs.ext2fs_open_inode_scan(fs, ctypes.byref(scan))
if ret != 0:
self.libext2fs.ext2fs_close(fs)
return []
try:
if self.libext2fs.ext2fs_open_inode_scan(fs, ctypes.byref(scan)) == 0:
inode_large = ext2_inode_large()
while self.libext2fs.ext2fs_get_next_inode(scan, ctypes.byref(inode_large)) == 0:
if inode_large.i_links_count > 1 and inode_large.i_file_acl == inode:
yield Path(fs.fs_mount_point) / scan.name.decode()
finally:
self.libext2fs.ext2fs_close_inode_scan(scan)
finally:
self.libext2fs.ext2fs_close(fs)