Skip to content

Commit

Permalink
wutdevoptab: Add support for opening files with (O_EXCL | O_CREAT | O…
Browse files Browse the repository at this point in the history
…_RDWR) and (O_EXCL | O_CREAT | O_WRONLY)
  • Loading branch information
Maschell committed Jun 18, 2023
1 parent 5f42c2c commit cd8e0b0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/wutdevoptab/devoptab_fsa_open.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ __wut_fsa_open(struct _reent *r,
fsMode = "w";
} else if (((flags & O_ACCMODE) == O_RDWR) && ((flags & commonFlagMask) == (O_CREAT | O_TRUNC))) {
fsMode = "w+";
} else if (((flags & O_ACCMODE) == O_WRONLY) && ((flags & commonFlagMask) == O_CREAT) && (flags & O_EXCL) == O_EXCL) {
// if O_EXCL is set, we don't need O_TRUNC
fsMode = "w";
} else if (((flags & O_ACCMODE) == O_RDWR) && ((flags & commonFlagMask) == O_CREAT) && (flags & O_EXCL) == O_EXCL) {
// if O_EXCL is set, we don't need O_TRUNC
fsMode = "w+";
} else if (((flags & O_ACCMODE) == O_WRONLY) && ((flags & commonFlagMask) == (O_CREAT | O_APPEND))) {
fsMode = "a";
} else if (((flags & O_ACCMODE) == O_RDWR) && ((flags & commonFlagMask) == (O_CREAT | O_APPEND))) {
Expand Down

0 comments on commit cd8e0b0

Please sign in to comment.