mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
fstest: If the file is deleted it will not be opened
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
This commit is contained in:
parent
fe51fed1e6
commit
ff85c8c0d9
1 changed files with 8 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue