mirror of
https://github.com/DarrylNixon/melamine.git
synced 2024-04-22 06:27:20 -07:00
Fix async yield with some try/finally
This commit is contained in:
parent
ab6eda59c2
commit
bcc9c70322
1 changed files with 13 additions and 17 deletions
|
@ -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()
|
scan = ext2_inode_scan()
|
||||||
ret = self.libext2fs.ext2fs_open_inode_scan(fs, ctypes.byref(scan))
|
try:
|
||||||
if ret != 0:
|
if self.libext2fs.ext2fs_open_inode_scan(fs, ctypes.byref(scan)) == 0:
|
||||||
self.libext2fs.ext2fs_close(fs)
|
|
||||||
return []
|
|
||||||
|
|
||||||
inode_large = ext2_inode_large()
|
inode_large = ext2_inode_large()
|
||||||
while self.libext2fs.ext2fs_get_next_inode(scan, ctypes.byref(inode_large)) == 0:
|
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:
|
if inode_large.i_links_count > 1 and inode_large.i_file_acl == inode:
|
||||||
yield Path(fs.fs_mount_point) / scan.name.decode()
|
yield Path(fs.fs_mount_point) / scan.name.decode()
|
||||||
|
finally:
|
||||||
self.libext2fs.ext2fs_close_inode_scan(scan)
|
self.libext2fs.ext2fs_close_inode_scan(scan)
|
||||||
|
finally:
|
||||||
self.libext2fs.ext2fs_close(fs)
|
self.libext2fs.ext2fs_close(fs)
|
||||||
|
|
Loading…
Reference in a new issue