summaryrefslogtreecommitdiff
path: root/lib/sqfshelper/write_export_table.c
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/sqfshelper/write_export_table.c
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/sqfshelper/write_export_table.c')
-rw-r--r--lib/sqfshelper/write_export_table.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/sqfshelper/write_export_table.c b/lib/sqfshelper/write_export_table.c
index 566c509..857cb5e 100644
--- a/lib/sqfshelper/write_export_table.c
+++ b/lib/sqfshelper/write_export_table.c
@@ -22,22 +22,18 @@ int write_export_table(sqfs_file_t *file, fstree_t *fs, sqfs_super_t *super,
if (fs->inode_tbl_size < 1)
return 0;
- table = alloc_array(sizeof(sqfs_u64), (fs->inode_tbl_size - 1));
+ table = alloc_array(sizeof(sqfs_u64), fs->inode_tbl_size);
if (table == NULL) {
perror("Allocating NFS export table");
return -1;
}
- for (i = 1; i < fs->inode_tbl_size; ++i) {
- if (fs->inode_table[i] == NULL) {
- table[i - 1] = htole64(0xFFFFFFFFFFFFFFFF);
- } else {
- table[i - 1] = htole64(fs->inode_table[i]->inode_ref);
- }
+ for (i = 0; i < fs->inode_tbl_size; ++i) {
+ table[i] = htole64(fs->inode_table[i]->inode_ref);
}
- size = sizeof(sqfs_u64) * (fs->inode_tbl_size - 1);
+ size = sizeof(sqfs_u64) * fs->inode_tbl_size;
ret = sqfs_write_table(file, cmp, table, size, &start);
super->export_table_start = start;