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 inode = path.stat().st_ino
fs = ext2_filsys() fs = ext2_filsys()
ret = self.libext2fs.ext2fs_open(path.encode(), 0, 0, 0, ctypes.byref(fs)) if self.libext2fs.ext2fs_open(path.encode(), 0, 0, 0, ctypes.byref(fs)) == 0:
if ret != 0: try:
return [] scan = ext2_inode_scan()
try:
scan = ext2_inode_scan() if self.libext2fs.ext2fs_open_inode_scan(fs, ctypes.byref(scan)) == 0:
ret = self.libext2fs.ext2fs_open_inode_scan(fs, ctypes.byref(scan)) inode_large = ext2_inode_large()
if ret != 0: while self.libext2fs.ext2fs_get_next_inode(scan, ctypes.byref(inode_large)) == 0:
self.libext2fs.ext2fs_close(fs) if inode_large.i_links_count > 1 and inode_large.i_file_acl == inode:
return [] yield Path(fs.fs_mount_point) / scan.name.decode()
finally:
inode_large = ext2_inode_large() self.libext2fs.ext2fs_close_inode_scan(scan)
while self.libext2fs.ext2fs_get_next_inode(scan, ctypes.byref(inode_large)) == 0: finally:
if inode_large.i_links_count > 1 and inode_large.i_file_acl == inode: self.libext2fs.ext2fs_close(fs)
yield Path(fs.fs_mount_point) / scan.name.decode()
self.libext2fs.ext2fs_close_inode_scan(scan)
self.libext2fs.ext2fs_close(fs)