Merge pull request #1567 from gportay/umount-fix-list-of-mount-points-to-unmount

[umount] Fix list of mount-points to unmount
This commit is contained in:
Adriaan de Groot 2020-11-04 16:09:02 +01:00 committed by GitHub
commit f18f425682
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,10 +39,11 @@ def list_mounts(root_mount_point):
"""
lst = []
root_mount_point = os.path.normpath(root_mount_point)
for line in open("/etc/mtab").readlines():
device, mount_point, _ = line.split(" ", 2)
if mount_point.startswith(root_mount_point):
if os.path.commonprefix([root_mount_point, mount_point]) == root_mount_point:
lst.append((device, mount_point))
return lst