Skip to content

Commit

Permalink
Fixes interpretation of O_CREAT in the CC32xxDeviceFile. (#610)
Browse files Browse the repository at this point in the history
When SL_FS_CREATE fails we will still attempt to do an FsOpen with SL_FS_WRITE instead of returning an error or crashing.
  • Loading branch information
balazsracz authored Feb 6, 2022
1 parent 8f768c8 commit 3196adb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/freertos_drivers/ti/CC32xxDeviceFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,16 @@ int CC32xxDeviceFile::open(File* file, const char *path, int flags, int mode)
else
{
/* file not open yet, open and intialize metadata */
int32_t result;
int32_t result = 0;
if (flags & O_CREAT)
{
result = sl_FsOpen((const unsigned char *)path,
SL_FS_CREATE |
SL_FS_CREATE_MAX_SIZE(maxSizeOnCreate),
nullptr);
}
if (result > 0)
{
writeEnable = true;
}
else if (flags & O_WRONLY)
Expand Down Expand Up @@ -163,6 +166,7 @@ void CC32xxDeviceFile::disable()
{
sl_FsClose(handle, nullptr, nullptr, 0);
handle = -1;
writeEnable = false;
}
}

Expand Down

0 comments on commit 3196adb

Please sign in to comment.