]> www.vanbest.org Git - motioneye-debian/commitdiff
diskctl: ignore bind mounts
authorCalin Crisan <ccrisan@gmail.com>
Sun, 11 Jan 2015 13:41:43 +0000 (15:41 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 11 Jan 2015 13:41:43 +0000 (15:41 +0200)
src/diskctl.py

index 7b3f67538c1cc409f6bd457d862fc0bfc1ec44a2..fbf9b9a5d5889beb9128157aabec7192d9559262 100644 (file)
@@ -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({