mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-03 21:29:05 +00:00
fstest: Force the minimum filename to 4 to avoid collisions
This commit is contained in:
parent
abd444f9ce
commit
f3828ccbca
1 changed files with 6 additions and 2 deletions
|
|
@ -39,6 +39,7 @@
|
|||
#include <errno.h>
|
||||
#include <crc32.h>
|
||||
#include <debug.h>
|
||||
#include <assert.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
|
@ -200,8 +201,11 @@ static inline void fstest_randname(FAR struct fstest_filedesc_s *file)
|
|||
int i;
|
||||
|
||||
dirlen = strlen(g_mountdir);
|
||||
maxname = CONFIG_TESTING_FSTEST_MAXNAME - dirlen;
|
||||
namelen = (rand() % maxname) + 1;
|
||||
|
||||
/* Force the max filename lengh and also the min name len = 4 */
|
||||
|
||||
maxname = CONFIG_TESTING_FSTEST_MAXNAME - dirlen - 3;
|
||||
namelen = (rand() % maxname) + 4;
|
||||
alloclen = namelen + dirlen;
|
||||
|
||||
file->name = (FAR char *)malloc(alloclen + 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue