diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-09-04 19:26:31 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-09-16 09:34:35 +0200 |
commit | 0a0cbefc6ebb6174aad3e6f0b8a6dea87aed49da (patch) | |
tree | 7b1a69382f7480e442620b6176c1673abcf81b3c /bin/rdsquashfs/rdsquashfs.c | |
parent | 4b994ac359757098ebc09263fff9e2290a58de71 (diff) |
Remodel file extraction tools to use libfstream
This commit rewrites the libtar write paths to use libfstream insead of
a FILE pointer. Also, the libcommon file extraction function is remodeled
to use libfstream.
In accordance, rdsquashfs, sqfs2tar and sqfsdiff have some minor
adjustments made to work with the ported libtar and libcommon.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/rdsquashfs/rdsquashfs.c')
-rw-r--r-- | bin/rdsquashfs/rdsquashfs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bin/rdsquashfs/rdsquashfs.c b/bin/rdsquashfs/rdsquashfs.c index 1c11afa..5b6ce19 100644 --- a/bin/rdsquashfs/rdsquashfs.c +++ b/bin/rdsquashfs/rdsquashfs.c @@ -115,18 +115,28 @@ int main(int argc, char **argv) if (stat_file(n)) goto out; break; - case OP_CAT: + case OP_CAT: { + ostream_t *fp; + if (!S_ISREG(n->inode->base.mode)) { fprintf(stderr, "/%s: not a regular file\n", opt.cmdpath); goto out; } + fp = ostream_open_stdout(); + if (fp == NULL) + goto out; + if (sqfs_data_reader_dump(opt.cmdpath, data, n->inode, - stdout, super.block_size, false)) { + fp, super.block_size)) { + sqfs_destroy(fp); goto out; } + + sqfs_destroy(fp); break; + } case OP_UNPACK: if (opt.unpack_root != NULL) { if (mkdir_p(opt.unpack_root)) |