summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@torproject.org>2011-10-20 10:54:16 -0300
committerTomás Touceda <chiiph@torproject.org>2011-10-20 11:00:14 -0300
commit53e9b2b3c0b10b3b0075da6acc59c032553813b7 (patch)
tree93f5e8a95e116358514685b96e560c63fa03a86e
parentae54ecfe477546cff95d3c6b2ffafbf7314d0554 (diff)
Fix possible race condition with os.path.exists
-rw-r--r--lib/thandy/packagesys/ThpPackages.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/thandy/packagesys/ThpPackages.py b/lib/thandy/packagesys/ThpPackages.py
index e4e12f6..da76c6b 100644
--- a/lib/thandy/packagesys/ThpPackages.py
+++ b/lib/thandy/packagesys/ThpPackages.py
@@ -27,8 +27,10 @@ class ThpDB(object):
if self._thp_db_root is None:
raise Exception("There is no THP_DB_ROOT variable set")
dbpath = os.path.join(self._thp_db_root, "pkg-status")
- if not os.path.exists(dbpath):
+ try:
os.mkdir(dbpath)
+ except OSError, e:
+ pass
def getPath(self):
""" Returns the path to the database root """