fstest: If the file is deleted it will not be opened
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
diff --git a/testing/fstest/fstest_main.c b/testing/fstest/fstest_main.c
index 9c57cae..875419b 100644
--- a/testing/fstest/fstest_main.c
+++ b/testing/fstest/fstest_main.c
@@ -597,18 +597,19 @@
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;
}