diff options
| author | Georg Brandl <georg@python.org> | 2006-12-09 09:10:18 (GMT) |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2006-12-09 09:10:18 (GMT) |
| commit | 2bcf0154d5412e0d03a30cbbe8a853c47ab6bfc5 (patch) | |
| tree | 78b4976dcc85eb9c33198d7f9b0d0d813497a650 | |
| parent | ed8f294f43d61fd8e0d5c134c566d85adeadcdfc (diff) | |
| download | cpython-2bcf0154d5412e0d03a30cbbe8a853c47ab6bfc5.zip cpython-2bcf0154d5412e0d03a30cbbe8a853c47ab6bfc5.tar.gz cpython-2bcf0154d5412e0d03a30cbbe8a853c47ab6bfc5.tar.bz2 | |
Patch #1608267: fix a race condition in os.makedirs() is the directory
to be created is already there.
(backport from rev. 52972)
| -rw-r--r-- | Lib/os.py | 11 | ||||
| -rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 11 insertions, 3 deletions
@@ -25,6 +25,8 @@ and opendir), and leave all pathname manipulation to os.path import sys +from errno import ENOENT, ENOTDIR, EEXIST + _names = sys.builtin_module_names # Note: more names are added to __all__ later. @@ -160,7 +162,12 @@ def makedirs(name, mode=0777): if not tail: head, tail = path.split(head) if head and tail and not path.exists(head): - makedirs(head, mode) + try: + makedirs(head, mode) + except OSError, e: + # be happy if someone already created the path + if e.errno != EEXIST: + raise if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists return mkdir(name, mode) @@ -359,8 +366,6 @@ def execvpe(file, args, env): __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) def _execvpe(file, args, env=None): - from errno import ENOENT, ENOTDIR - if env is not None: func = execve argrest = (args, env) @@ -118,6 +118,9 @@ Extension Modules Library ------- +- Patch #1608267: fix a race condition in os.makedirs() is the directory + to be created is already there. + - Patch #1610437: fix a tarfile bug with long filename headers. - Patch #1472877: Fix Tix subwidget name resolution. |
