summaryrefslogtreecommitdiff
path: root/lib/sqfshelper/tree_node_from_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfshelper/tree_node_from_inode.c')
-rw-r--r--lib/sqfshelper/tree_node_from_inode.c18
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;