mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
fix 'mkdir(): File exists' error on create directory from parallel
processes
This commit is contained in:
@@ -37,9 +37,11 @@ class Smarty_Internal_Runtime_WriteFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
$_dirpath = dirname($_filepath);
|
$_dirpath = dirname($_filepath);
|
||||||
|
|
||||||
// if subdirs, create dir structure
|
// if subdirs, create dir structure
|
||||||
if ($_dirpath !== '.' && !file_exists($_dirpath)) {
|
if ($_dirpath !== '.' && !@mkdir($_dirpath, $_dir_perms, true) && !is_dir($_dirpath)) {
|
||||||
mkdir($_dirpath, $_dir_perms, true);
|
error_reporting($_error_reporting);
|
||||||
|
throw new SmartyException("unable to create directory {$_dirpath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// write to tmp file, then move to overt file lock race condition
|
// write to tmp file, then move to overt file lock race condition
|
||||||
|
Reference in New Issue
Block a user