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