diff options
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)) |