[CalendarServer-changes] [1435]
CalendarServer/trunk/twistedcaldav/static.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 30 10:14:50 PDT 2007
Revision: 1435
http://trac.macosforge.org/projects/calendarserver/changeset/1435
Author: wsanchez at apple.com
Date: 2007-03-30 10:14:48 -0700 (Fri, 30 Mar 2007)
Log Message:
-----------
If we're not a collection but makedirs() fails, it could be because
someone else came along and did it for us.
Deal with the race condition by checking again if makedirs() raises,
and re-raise only if we're still not a collection.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/static.py
Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py 2007-03-29 18:52:31 UTC (rev 1434)
+++ CalendarServer/trunk/twistedcaldav/static.py 2007-03-30 17:14:48 UTC (rev 1435)
@@ -404,7 +404,13 @@
assert parent.isCollection()
if self.isCollection():
- fp.makedirs()
+ try:
+ fp.makedirs()
+ except OSError:
+ # It's possible someone else created the directory in the meantime...
+ # Check our status again, and re-raise if we're not a collection.
+ if not self.isCollection():
+ raise
fp.restat(False)
else:
fp.open("w").close()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070330/36137797/attachment.html
More information about the calendarserver-changes
mailing list