[gobject-introspection] scanner: Don't fail on mkdir if cachedir already exists



commit 2b3517b1cfd6d38794877b12a82fa2d6da69fdcd
Author: Colin Walters <walters verbum org>
Date:   Thu Feb 3 14:35:32 2011 -0500

    scanner: Don't fail on mkdir if cachedir already exists
    
    Hit this race in practice with two g-ir-scanner invocations
    in Fedora's koji.

 giscanner/cachestore.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py
index d72eee4..7b72b29 100644
--- a/giscanner/cachestore.py
+++ b/giscanner/cachestore.py
@@ -56,7 +56,10 @@ def _get_cachedir():
 
     scannerdir = os.path.join(cachedir, 'g-ir-scanner')
     if not os.path.exists(scannerdir):
-        os.mkdir(scannerdir, 0755)
+        try:
+            os.mkdir(scannerdir, 0755)
+        except OSError:
+            return None
     # If it exists and is a file, don't cache at all
     elif not os.path.isdir(scannerdir):
         return None



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]