bug 463411 - nsinstall.exe can race creating directories. r=timeless

This commit is contained in:
Ted Mielczarek 2009-10-30 13:00:20 -04:00
Родитель d3c79aa757
Коммит ac6fe958a3
1 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -150,15 +150,18 @@ shellMkdir (wchar_t **pArgv)
/* check if directory already exists */
_wgetcwd ( path, _MAX_PATH );
if ( _wchdir ( tmpPath ) != -1 ) {
_wchdir ( path );
} else {
if ( _wmkdir ( tmpPath ) == -1 ) {
printf ( "%ls: ", tmpPath );
perror ( "Could not create the directory" );
if ( _wchdir ( tmpPath ) == -1 &&
_wmkdir ( tmpPath ) == -1 && // might have hit EEXIST
_wchdir ( tmpPath ) == -1) { // so try again
char buf[2048];
_snprintf(buf, 2048, "Could not create the directory: %S",
tmpPath);
perror ( buf );
retVal = 3;
break;
}
} else {
// get back to the cwd
_wchdir ( path );
}
if ( *pArg == '\0' ) /* complete path? */
break;