summaryrefslogtreecommitdiff
path: root/unpack/unsquashfs.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-01 16:55:08 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-02 12:40:06 +0200
commit31d327c3780aecdb78304263f676ff89a8ea93d1 (patch)
tree747b11109f1748011d79ee7f388e89025b065cf5 /unpack/unsquashfs.c
parent6ba88daae14e64009619562209060532eb6eadbb (diff)
unsquashfs: read ID table from file
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'unpack/unsquashfs.c')
-rw-r--r--unpack/unsquashfs.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/unpack/unsquashfs.c b/unpack/unsquashfs.c
index 4606366..f5c3a43 100644
--- a/unpack/unsquashfs.c
+++ b/unpack/unsquashfs.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */
#include "squashfs.h"
#include "compress.h"
+#include "id_table.h"
#include <stdlib.h>
#include <unistd.h>
@@ -14,6 +15,7 @@ int main(int argc, char **argv)
int fd, status = EXIT_FAILURE;
sqfs_super_t super;
compressor_t *cmp;
+ id_table_t idtbl;
if (argc != 2) {
fprintf(stderr, "Usage: %s <filename>\n", __progname);
@@ -56,8 +58,16 @@ int main(int argc, char **argv)
if (cmp == NULL)
goto out;
- status = EXIT_SUCCESS;
+ if (id_table_init(&idtbl))
+ goto out_cmp;
+
+ if (id_table_read(&idtbl, fd, &super, cmp))
+ goto out_idtbl;
+ status = EXIT_SUCCESS;
+out_idtbl:
+ id_table_cleanup(&idtbl);
+out_cmp:
cmp->destroy(cmp);
out:
close(fd);