fstest: If the file is deleted it will not be opened

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
This commit is contained in:
zhangshoukui 2024-08-05 19:29:52 +08:00 committed by Xiang Xiao
parent fe51fed1e6
commit ff85c8c0d9

View File

@ -597,18 +597,19 @@ static inline int fstest_rdfile(FAR struct fstest_ctx_s *ctx,
uint32_t crc;
int fd;
if (file->deleted)
{
return ERROR;
}
/* Open the file for reading */
fd = open(file->name, O_RDONLY);
if (fd < 0)
{
if (!file->deleted)
{
printf("ERROR: Failed to open file for reading: %d\n", errno);
printf(" File name: %s\n", file->name);
printf(" File size: %zd\n", file->len);
}
printf("ERROR: Failed to open file for reading: %d\n", errno);
printf(" File name: %s\n", file->name);
printf(" File size: %zd\n", file->len);
return ERROR;
}