summaryrefslogtreecommitdiff
path: root/lib/sqfshelper/deserialize_fstree.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-07 20:19:05 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-07 20:40:07 +0200
commit60064dd0412a149fe00cfc4e2f2361c22656db57 (patch)
treef4a2aaed857aeca621ee96e46e23858d4025fcf8 /lib/sqfshelper/deserialize_fstree.c
parente71c56420a8fc3dc7e36eb059304a362b47a1c15 (diff)
Remove printing to stderr in libsquashfs with returning error numbers
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfshelper/deserialize_fstree.c')
-rw-r--r--lib/sqfshelper/deserialize_fstree.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/sqfshelper/deserialize_fstree.c b/lib/sqfshelper/deserialize_fstree.c
index a3cf44d..1953f9b 100644
--- a/lib/sqfshelper/deserialize_fstree.c
+++ b/lib/sqfshelper/deserialize_fstree.c
@@ -90,6 +90,7 @@ static int fill_dir(sqfs_meta_reader_t *ir, sqfs_meta_reader_t *dr,
uint64_t block_start;
size_t size, diff;
uint32_t i;
+ int err;
size = root->data.dir->size;
if (size <= sizeof(hdr))
@@ -110,8 +111,7 @@ static int fill_dir(sqfs_meta_reader_t *ir, sqfs_meta_reader_t *dr,
size -= sizeof(hdr);
for (i = 0; i <= hdr.count && size > sizeof(*ent); ++i) {
- ent = sqfs_meta_reader_read_dir_ent(dr);
- if (ent == NULL)
+ if (sqfs_meta_reader_read_dir_ent(dr, &ent))
return -1;
diff = sizeof(*ent) + strlen((char *)ent->name);
@@ -126,12 +126,12 @@ static int fill_dir(sqfs_meta_reader_t *ir, sqfs_meta_reader_t *dr,
continue;
}
- inode = sqfs_meta_reader_read_inode(ir, super,
- hdr.start_block,
- ent->offset);
- if (inode == NULL) {
+ err = sqfs_meta_reader_read_inode(ir, super,
+ hdr.start_block,
+ ent->offset, &inode);
+ if (err) {
free(ent);
- return -1;
+ return err;
}
n = tree_node_from_inode(inode, idtbl,
@@ -240,10 +240,12 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super,
if (xr == NULL)
goto out_id;
+ if (sqfs_xattr_reader_load_locations(xr))
+ goto out_xr;
+
block_start = super->root_inode_ref >> 16;
offset = super->root_inode_ref & 0xFFFF;
- root = sqfs_meta_reader_read_inode(ir, super, block_start, offset);
- if (root == NULL)
+ if (sqfs_meta_reader_read_inode(ir, super, block_start, offset, &root))
goto out_xr;
if (root->base.type != SQFS_INODE_DIR &&