[PATCH mtd-utils] fs-tests: integck: Allow checking root
Csókás, Bence
csokas.bence at prolan.hu
Thu Aug 8 05:31:50 PDT 2024
Trailing slash removal creates an empty string
from '/', making it impossible to check the
root filesystem.
Signed-off-by: Csókás, Bence <csokas.bence at prolan.hu>
---
tests/fs-tests/integrity/integck.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 0a7f142..b7cedc2 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -2946,9 +2946,11 @@ static void get_tested_fs_info(void)
/* Remove trailing '/' symbols from the mount point */
p = dup_string(args.mount_point);
fsinfo.mount_point = p;
- p += strlen(p);
- while (*--p == '/');
- *(p + 1) = '\0';
+ if (strlen(p) > 1) {
+ p += strlen(p);
+ while (*--p == '/');
+ *(p + 1) = '\0';
+ }
CHECK(statfs(fsinfo.mount_point, &fs_info) == 0);
fsinfo.max_name_len = fs_info.f_namelen;
--
2.34.1
More information about the linux-mtd
mailing list