summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <dawagner@gmail.com>2015-11-12 12:05:21 +0000
committerDaniel Wagner-Hall <dawagner@gmail.com>2015-11-12 12:05:21 +0000
commit2fc81af06a8b5e2ff56093466d6b1c8ddfd97d3c (patch)
treec615718d013da8d34b50deadf80d2bfc4e28d492 /synapse
parentMerge branch 'release-v0.11.0' of github.com:matrix-org/synapse into develop (diff)
parentFix race creating directories (diff)
downloadsynapse-2fc81af06a8b5e2ff56093466d6b1c8ddfd97d3c.tar.xz
Merge pull request #362 from matrix-org/daniel/raceyraceyfunfun
Fix race creating directories
Diffstat (limited to 'synapse')
-rw-r--r--synapse/config/_base.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py
index ceef309afc..c18e0bdbb8 100644
--- a/synapse/config/_base.py
+++ b/synapse/config/_base.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 import argparse
+import errno
 import os
 import yaml
 import sys
@@ -91,8 +92,11 @@ class Config(object):
     @classmethod
     def ensure_directory(cls, dir_path):
         dir_path = cls.abspath(dir_path)
-        if not os.path.exists(dir_path):
+        try:
             os.makedirs(dir_path)
+        except OSError, e:
+            if e.errno != errno.EEXIST:
+                raise
         if not os.path.isdir(dir_path):
             raise ConfigError(
                 "%s is not a directory" % (dir_path,)