Bug 402460 CreateUnique is very slow and returns bogus error for write-protected directory r=bsmedberg a=mtschrep

This commit is contained in:
neil%parkwaycc.co.uk 2007-11-12 09:24:32 +00:00
Родитель 6022d7faa2
Коммит b8d466fd70
2 изменённых файлов: 8 добавлений и 8 удалений

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

@ -837,7 +837,8 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes)
if (type == NORMAL_FILE_TYPE) if (type == NORMAL_FILE_TYPE)
{ {
PRFileDesc* file = PR_Open(mWorkingPath.get(), PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes); PRFileDesc* file = PR_Open(mWorkingPath.get(), PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes);
if (!file) return NS_ERROR_FILE_ALREADY_EXISTS; if (!file)
return NS_ErrorAccordingToNSPR();
PR_Close(file); PR_Close(file);
return NS_OK; return NS_OK;

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

@ -1036,13 +1036,12 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes)
if (type == NORMAL_FILE_TYPE) if (type == NORMAL_FILE_TYPE)
{ {
PRFileDesc* file; PRFileDesc* file;
OpenFile(mResolvedPath, rv = OpenFile(mResolvedPath,
PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes, PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes,
&file); &file);
if (!file) return NS_ERROR_FILE_ALREADY_EXISTS; if (file)
PR_Close(file);
PR_Close(file); return rv;
return NS_OK;
} }
if (type == DIRECTORY_TYPE) if (type == DIRECTORY_TYPE)