summaryrefslogtreecommitdiff
path: root/lib/sqfs/write_export_table.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 19:16:11 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 19:16:11 +0200
commitf49fe3bbf0d52e2afcc1ace8c1f48dee9349d4f8 (patch)
tree41e55971f8f1052c0457332dbf5718f7b7a9c661 /lib/sqfs/write_export_table.c
parent798abd9eaf3c9e8aa83c4dca28cdd44890253efe (diff)
Cleanup sqfs_write_table
This commit attempts to make the generic table writer more readable. A few changes are made, including heap allocation of the block list. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/write_export_table.c')
-rw-r--r--lib/sqfs/write_export_table.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqfs/write_export_table.c b/lib/sqfs/write_export_table.c
index a0d81eb..8794609 100644
--- a/lib/sqfs/write_export_table.c
+++ b/lib/sqfs/write_export_table.c
@@ -10,10 +10,11 @@ int write_export_table(int outfd, fstree_t *fs, sqfs_super_t *super,
compressor_t *cmp)
{
uint64_t *table, start;
- size_t i;
+ size_t i, size;
int ret;
- table = malloc(sizeof(uint64_t) * (fs->inode_tbl_size - 1));
+ size = sizeof(uint64_t) * (fs->inode_tbl_size - 1);
+ table = malloc(size);
if (table == NULL) {
perror("Allocating NFS export table");
@@ -28,8 +29,7 @@ int write_export_table(int outfd, fstree_t *fs, sqfs_super_t *super,
}
}
- ret = sqfs_write_table(outfd, super, table, sizeof(table[0]),
- fs->inode_tbl_size - 1, &start, cmp);
+ ret = sqfs_write_table(outfd, super, cmp, table, size, &start);
super->export_table_start = start;
super->flags |= SQFS_FLAG_EXPORTABLE;