skip IOError for non-existing ld.so.conf.d file
authorHajime Tazaki <tazaki@nict.go.jp>
Fri, 12 Apr 2013 21:18:28 +0900
changeset 661 880bcaaf89e1
parent 660 9e189e9410de
child 662 9ad1c09619ae
skip IOError for non-existing ld.so.conf.d file
extract-system-config.py
--- a/extract-system-config.py	Tue Apr 09 23:46:03 2013 +0900
+++ b/extract-system-config.py	Fri Apr 12 21:18:28 2013 +0900
@@ -160,10 +160,13 @@
     paths = []
     re_lib = re.compile ('(?<=^#)')
     for filename in os.listdir("/etc/ld.so.conf.d/"):
-        for line in open ("/etc/ld.so.conf.d/" + filename, 'r'):
-            if re_lib.search (line) is not None:
-                continue
-            paths.append(line.rstrip ())
+        try:
+            for line in open ("/etc/ld.so.conf.d/" + filename, 'r'):
+                if re_lib.search (line) is not None:
+                    continue
+                paths.append(line.rstrip ())
+        except:
+            continue
     return ':'.join(paths)
         
 def usage():