diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-01 23:08:04 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-01 23:08:36 +0200 |
commit | 9d9d4505f58b6584fe3b261a7686c5d779f77c11 (patch) | |
tree | 7f1a086abc273c55c4d3a9cf96144715e3d15329 /lib/sqfshelper/tree_node_from_inode.c | |
parent | 307107ecd2fc3ffbf6fe91497daf767700f3572f (diff) |
Internalize the layout of the id_table_t structure
As an opaque struct it has a chance to change its layout in the future
without breaking ABI compatibiliy.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfshelper/tree_node_from_inode.c')
-rw-r--r-- | lib/sqfshelper/tree_node_from_inode.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/sqfshelper/tree_node_from_inode.c b/lib/sqfshelper/tree_node_from_inode.c index 582399c..e77266a 100644 --- a/lib/sqfshelper/tree_node_from_inode.c +++ b/lib/sqfshelper/tree_node_from_inode.c @@ -73,26 +73,22 @@ tree_node_t *tree_node_from_inode(sqfs_inode_generic_t *inode, { tree_node_t *out; - if (inode->base.uid_idx >= idtbl->num_ids) { - fputs("converting inode to fs tree node: UID out of range\n", - stderr); + out = calloc(1, compute_size(inode, name, block_size)); + if (out == NULL) { + perror("converting inode to fs tree node"); return NULL; } - if (inode->base.gid_idx >= idtbl->num_ids) { - fputs("converting inode to fs tree node: GID out of range\n", - stderr); + if (id_table_index_to_id(idtbl, inode->base.uid_idx, &out->uid)) { + free(out); return NULL; } - out = calloc(1, compute_size(inode, name, block_size)); - if (out == NULL) { - perror("converting inode to fs tree node"); + if (id_table_index_to_id(idtbl, inode->base.gid_idx, &out->gid)) { + free(out); return NULL; } - out->uid = idtbl->ids[inode->base.uid_idx]; - out->gid = idtbl->ids[inode->base.gid_idx]; out->mode = inode->base.mode; out->inode_num = inode->base.inode_number; out->mod_time = inode->base.mod_time; |