aboutsummaryrefslogtreecommitdiffstats
path: root/mpm
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-04-20 18:31:31 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-04-21 15:20:24 -0500
commit0a0c1bb7defe74d93aa55a28eea2d481efd761a4 (patch)
treedf1e22d21442f4de945e9f93fcd1fc59f486a6d9 /mpm
parent595264854f9b747c2fdf088e01cbaab7abc4284f (diff)
downloaduhd-0a0c1bb7defe74d93aa55a28eea2d481efd761a4.tar.gz
uhd-0a0c1bb7defe74d93aa55a28eea2d481efd761a4.tar.bz2
uhd-0a0c1bb7defe74d93aa55a28eea2d481efd761a4.zip
mpm: sysutils: mount: Check both mount point and data path
This will return False on ismounted() if a Mount class is mounted, but in the wrong spot.
Diffstat (limited to 'mpm')
-rw-r--r--mpm/python/usrp_mpm/sys_utils/mount.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mpm/python/usrp_mpm/sys_utils/mount.py b/mpm/python/usrp_mpm/sys_utils/mount.py
index 3212a37cb..6dcadf03f 100644
--- a/mpm/python/usrp_mpm/sys_utils/mount.py
+++ b/mpm/python/usrp_mpm/sys_utils/mount.py
@@ -35,10 +35,11 @@ class Mount():
Returns true if the mount point is mounted
"""
assert self.devicepath is not None
- collection = [line.split()[0] for line in open("/etc/mtab")
- if line.split()[0] == self.devicepath]
- mounted = len(collection) != 0
- return mounted
+ with open("/etc/mtab") as mtab_f:
+ return any(
+ line.split()[0] == self.devicepath and line.split()[1] == self.mountpoint \
+ for line in mtab_f
+ )
def get_mount_point(self):
"""