Skip to content

Commit 46435a1

Browse files
authored
Merge pull request #2505 from gmittert/ExclusiveBehavior
[Windows] O_EXCL should override O_TRUNC
2 parents c949d7d + 3171201 commit 46435a1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

CoreFoundation/Base.subproj/CFPlatform.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,15 +906,16 @@ CF_EXPORT int _NS_open(const char *name, int oflag, int pmode) {
906906

907907
DWORD dwCreationDisposition;
908908
switch (oflag & (O_CREAT | O_EXCL | O_TRUNC)) {
909+
case O_CREAT | O_EXCL | O_TRUNC:
910+
case O_CREAT | O_EXCL:
911+
dwCreationDisposition = CREATE_NEW;
912+
break;
909913
case O_CREAT | O_TRUNC:
910914
dwCreationDisposition = CREATE_ALWAYS;
911915
break;
912916
case O_CREAT:
913917
dwCreationDisposition = OPEN_ALWAYS;
914918
break;
915-
case O_EXCL:
916-
dwCreationDisposition = CREATE_NEW;
917-
break;
918919
case O_TRUNC:
919920
dwCreationDisposition = TRUNCATE_EXISTING;
920921
break;

0 commit comments

Comments
 (0)