Commit dbe4a393 by Jordi Boggiano

Prevent race conditions

parent 9a9e6c59
...@@ -482,7 +482,15 @@ class Dwoo_Template_String implements Dwoo_ITemplate ...@@ -482,7 +482,15 @@ class Dwoo_Template_String implements Dwoo_ITemplate
} else { } else {
$chmod = $this->chmod; $chmod = $this->chmod;
} }
mkdir($path, $chmod, true);
$retries = 3;
while ($retries--) {
@mkdir($path, $chmod, true);
if (is_dir($path)) {
break;
}
usleep(20);
}
// enforce the correct mode for all directories created // enforce the correct mode for all directories created
if (strpos(PHP_OS, 'WIN') !== 0 && $baseDir !== null) { if (strpos(PHP_OS, 'WIN') !== 0 && $baseDir !== null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment