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:
commit
f18f425682
@ -39,10 +39,11 @@ def list_mounts(root_mount_point):
|
|||||||
"""
|
"""
|
||||||
lst = []
|
lst = []
|
||||||
|
|
||||||
|
root_mount_point = os.path.normpath(root_mount_point)
|
||||||
for line in open("/etc/mtab").readlines():
|
for line in open("/etc/mtab").readlines():
|
||||||
device, mount_point, _ = line.split(" ", 2)
|
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))
|
lst.append((device, mount_point))
|
||||||
|
|
||||||
return lst
|
return lst
|
||||||
|
Loading…
Reference in New Issue
Block a user