]> arthur.barton.de Git - bup.git/commitdiff
cleanup-mounts-under: Don't fail when /proc/mounts isn't readable cleanup-mounts-under
authorAlexander Barton <alex@barton.de>
Wed, 31 Dec 2014 17:53:34 +0000 (18:53 +0100)
committerAlexander Barton <alex@barton.de>
Wed, 31 Dec 2014 17:53:34 +0000 (18:53 +0100)
Not all operating systems provide a "/proc/mounts" file (for exmaple,
Darwin/OS X doesn't), so ignore this error for now ...

This doesn't solve the problem per se but makes "make clean" usable
on those systems again.

Signed-off-by: Alexander Barton <alex@barton.de>
t/cleanup-mounts-under

index a8ba61158cb528b4c53f536243e6a071354baaf5..8f766c321735ef10caa4d3350960331e44659195 100755 (executable)
@@ -17,11 +17,17 @@ targets = sys.argv[1:]
 exit_status = 0
 for target in targets:
     if not os.path.isdir(target):
-        print >> sys.stderr, target, 'is not a directory'
+        print >> sys.stderr, target, 'is not a directory!'
         exit_status = 1
         continue
+
     top = os.path.realpath(target)
-    proc_mounts = open('/proc/mounts', 'r')
+    try:
+        proc_mounts = open('/proc/mounts', 'r')
+    except IOError:
+        print >> sys.stdout, 'Cannot open /proc/mounts!'
+        sys.exit(1)
+
     for line in proc_mounts:
         _, point, fstype, _ = line.split(' ', 3)
         point = mntent_unescape(point)