diff --git a/xpcom/io/nsLocalFileOS2.cpp b/xpcom/io/nsLocalFileOS2.cpp index ae2f7fbe9d4..8ef144a0cd4 100644 --- a/xpcom/io/nsLocalFileOS2.cpp +++ b/xpcom/io/nsLocalFileOS2.cpp @@ -837,7 +837,8 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes) if (type == NORMAL_FILE_TYPE) { 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); return NS_OK; diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 9958b42a5c2..3edc82754d2 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -1036,13 +1036,12 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes) if (type == NORMAL_FILE_TYPE) { PRFileDesc* file; - OpenFile(mResolvedPath, - PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes, - &file); - if (!file) return NS_ERROR_FILE_ALREADY_EXISTS; - - PR_Close(file); - return NS_OK; + rv = OpenFile(mResolvedPath, + PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes, + &file); + if (file) + PR_Close(file); + return rv; } if (type == DIRECTORY_TYPE)