From 6331bacb16806f9145f6e5bf8c4026e28b821a42 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 11 Jan 2015 15:41:43 +0200 Subject: [PATCH] diskctl: ignore bind mounts --- src/diskctl.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/diskctl.py b/src/diskctl.py index 7b3f675..fbf9b9a 100644 --- a/src/diskctl.py +++ b/src/diskctl.py @@ -23,6 +23,8 @@ import re def _list_mounts(): logging.debug('listing mounts...') + seen_targets = set() + mounts = [] with open('/proc/mounts', 'r') as f: for line in f: @@ -40,10 +42,15 @@ def _list_mounts(): if not os.access(mount_point, os.W_OK): continue + + if target in seen_targets: + continue # probably a bind mount + + seen_targets.add(target) if fstype == 'fuseblk': - fstype = 'ntfs' # most likely' - + fstype = 'ntfs' # most likely + logging.debug('found mount "%s" at "%s"' % (target, mount_point)) mounts.append({ -- 2.39.5