[Filesystem Component] mkdir race condition fix #11626
This commit is contained in:
parent
b674e678db
commit
04834521f1
|
@ -78,7 +78,14 @@ class Filesystem
|
|||
}
|
||||
|
||||
if (true !== @mkdir($dir, $mode, true)) {
|
||||
throw new IOException(sprintf('Failed to create %s', $dir));
|
||||
$error = error_get_last();
|
||||
if (!is_dir($dir)) {
|
||||
// The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one
|
||||
if ($error) {
|
||||
throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']));
|
||||
}
|
||||
throw new IOException(sprintf('Failed to create "%s"', $dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue