From: Calin Crisan Date: Sun, 11 Jan 2015 13:41:43 +0000 (+0200) Subject: diskctl: ignore bind mounts X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=6331bacb16806f9145f6e5bf8c4026e28b821a42;p=motioneye-debian diskctl: ignore bind mounts --- 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({