Skip to content

Commit

Permalink
Check make_temp_dir output
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Dec 2, 2023
1 parent abc9701 commit 32278ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/file_open_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FEATURE(file_open, "File open")
GIVEN("a file with a long filename in a folder with a long filename")
char folder[4096];
make_temp_dir("temp_dir_", folder);
ASSERT(strlen(folder) > 0, 1);
strcat(folder, "/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
mkdir(folder, 0700);
strcat(folder, "/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
Expand Down
5 changes: 4 additions & 1 deletion tests/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ void make_temp_dir(const char *prefix, char *out)
}
#else
sprintf(out, "%sXXXXXX", prefix);
(void)mkdtemp(out);
if (mkdtemp(out) == NULL)
{
out[0] = '\0';
}
#endif
}

0 comments on commit 32278ef

Please sign in to comment.