summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-21 21:58:48 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-21 21:58:48 +0200
commitc673f305ec0c2c80bc3873bcc8718d9ba85340c9 (patch)
treeec3ad951ccd3d2688682c17a1ba6f73827e93c5f /lib
parent4aeac131e3fcb92fc624c8e51ff6e3dc22f11ce3 (diff)
Fix indexing into export table
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/sqfs/write_export_table.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqfs/write_export_table.c b/lib/sqfs/write_export_table.c
index eee4e01..2815cc2 100644
--- a/lib/sqfs/write_export_table.c
+++ b/lib/sqfs/write_export_table.c
@@ -11,23 +11,23 @@ int write_export_table(int outfd, fstree_t *fs, sqfs_super_t *super,
size_t i;
int ret;
- table = malloc(sizeof(uint64_t) * fs->inode_tbl_size);
+ table = malloc(sizeof(uint64_t) * (fs->inode_tbl_size - 1));
if (table == NULL) {
perror("Allocating NFS export table");
return -1;
}
- for (i = 0; i < fs->inode_tbl_size; ++i) {
+ for (i = 1; i < fs->inode_tbl_size; ++i) {
if (fs->inode_table[i] == NULL) {
- table[i] = 0xFFFFFFFFFFFFFFFF;
+ table[i - 1] = htole64(0xFFFFFFFFFFFFFFFF);
} else {
- table[i] = htole64(fs->inode_table[i]->inode_ref);
+ table[i - 1] = htole64(fs->inode_table[i]->inode_ref);
}
}
ret = sqfs_write_table(outfd, super, table, sizeof(table[0]),
- fs->inode_tbl_size, &start, cmp);
+ fs->inode_tbl_size - 1, &start, cmp);
super->export_table_start = start;
super->flags |= SQFS_FLAG_EXPORTABLE;