Skip to content

Commit

Permalink
Merge pull request #112 from irowebbn/111-max_file-len-move-test
Browse files Browse the repository at this point in the history
Fix #111: Use correct length filename for too large test
  • Loading branch information
dzbaker authored Dec 5, 2023
2 parents 7b20419 + f600acd commit f04f6a0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions unit-test/ds_file_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,12 +960,15 @@ void DS_FileCloseDest_Test_PlatformConfigMoveFiles_MoveError(void)
void DS_FileCloseDest_Test_PlatformConfigMoveFiles_FilenameTooLarge(void)
{
int32 FileIndex = 0;

const char DirName[] = "directory1/";

/* Set up the handle */
OS_OpenCreate(&DS_AppData.FileStatus[FileIndex].FileHandle, NULL, 0, 0);

strncpy(DS_AppData.FileStatus[FileIndex].FileName, "directory1/filenamefilenamefilenamefilenamefilenamefilename",
sizeof(DS_AppData.FileStatus[FileIndex].FileName));

size_t DirNameLen = sizeof(DirName);
strncpy(DS_AppData.FileStatus[FileIndex].FileName, DirName, DirNameLen);
memset(&DS_AppData.FileStatus[FileIndex].FileName[DirNameLen-1], 'f', DS_TOTAL_FNAME_BUFSIZE - DirNameLen);
DS_AppData.FileStatus[FileIndex].FileName[DS_TOTAL_FNAME_BUFSIZE-1] = '\0';
strncpy(DS_AppData.DestFileTblPtr->File[FileIndex].Movename, "directory2/movename/",
sizeof(DS_AppData.DestFileTblPtr->File[FileIndex].Movename));

Expand Down

0 comments on commit f04f6a0

Please sign in to comment.