:: commit 3f7ab868a32922c694f8edcb6037f3ad22ff9f58

mintsuki <mintsuki@protonmail.com> — 2022-08-21 05:15

parents: b00ad794de

ext: Fix next_cwd_len calculation

diff --git a/common/fs/ext2.s2.c b/common/fs/ext2.s2.c
index 07232243..d57ad0e6 100644
--- a/common/fs/ext2.s2.c
+++ b/common/fs/ext2.s2.c
@@ -385,19 +385,18 @@ static bool ext2_parse_dirent(struct ext2_dir_entry *dir, struct ext2_file_handl
 
     const char *cwd = path - 1; // because /
     size_t cwd_len = 1;
+    size_t next_cwd_len = cwd_len;
 
 next:
     memset(token, 0, 256);
 
-    size_t next_cwd_len = cwd_len;
-
     for (size_t i = 0; i < 255 && *path != '/' && *path != '\0'; i++, path++, next_cwd_len++)
         token[i] = *path;
 
     if (*path == '\0')
         escape = true;
     else
-        path++;
+        path++, next_cwd_len++;
 
     uint32_t *alloc_map = create_alloc_map(fd, &current_inode);
 
tab: 248 wrap: offon