BugZilla 17558. PR_Open() gets PR_EXCL flag

git-svn-id: svn://10.0.0.236/trunk@52824 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
larryh%netscape.com
1999-11-05 00:21:39 +00:00
parent 3189ded990
commit 1f62cd6fa3

View File

@@ -401,13 +401,21 @@ PRInt32 _MD_Open(const char *path, PRIntn flags, int mode)
hpb.ioParam.ioPermssn = perm;
open:
err = PBHOpenDFSync(&hpb);
if ((err == fnfErr) && (flags & PR_CREATE_FILE)) {
if (flags & PR_CREATE_FILE) {
err = PBHCreateSync(&hpb);
if (err == noErr)
goto open;
/* If opening with the PR_EXCL flag the existence of the file prior to opening is an error */
if ((flags & PR_EXCL) && (err == dupFNErr)) {
err = PR_FILE_EXISTS_ERROR;
goto ErrorExit;
}
if (err != noErr)
goto ErrorExit;
}
open:
err = PBHOpenDFSync(&hpb);
if (err != noErr)
goto ErrorExit;