aboutsummaryrefslogtreecommitdiff
path: root/lib/fstree
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-29 02:41:50 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-29 02:41:50 +0200
commit064258c7bb285163fe2deabe411e39c2b9d1e755 (patch)
tree672e27143504695920dd12f2a26ccb6f49a4cb80 /lib/fstree
parent318d14cabf4e29373006e04ee855f9583b0ce3a5 (diff)
Fix inode numbering: always start with 1, use 0 as parent for the root
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstree')
-rw-r--r--lib/fstree/gen_inode_table.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/fstree/gen_inode_table.c b/lib/fstree/gen_inode_table.c
index 80686d6..988fa79 100644
--- a/lib/fstree/gen_inode_table.c
+++ b/lib/fstree/gen_inode_table.c
@@ -52,15 +52,15 @@ static void map_child_nodes(fstree_t *fs, tree_node_t *root, size_t *counter)
it->inode_num = *counter;
*counter += 1;
- fs->inode_table[it->inode_num] = it;
+ fs->inode_table[it->inode_num - 1] = it;
}
}
int fstree_gen_inode_table(fstree_t *fs)
{
- size_t inum = 2;
+ size_t inum = 1;
- fs->inode_tbl_size = count_nodes(fs->root) + 2;
+ fs->inode_tbl_size = count_nodes(fs->root);
fs->inode_table = alloc_array(sizeof(tree_node_t *),
fs->inode_tbl_size);
@@ -71,6 +71,6 @@ int fstree_gen_inode_table(fstree_t *fs)
map_child_nodes(fs, fs->root, &inum);
fs->root->inode_num = inum;
- fs->inode_table[inum] = fs->root;
+ fs->inode_table[inum - 1] = fs->root;
return 0;
}