Algorithmatic
Algorithmatic

Reputation: 1892

libarchive how to read concatenated tar

I want to read a tar file that was made by concatenating multiple .tar.gz files using cat one.tar.gz two.tar.gz .... > combined.tar.gz using libarchive.

I'm able to read files for the first tar file fine using a while(;;) r = archive_read_next_header(a, &entry);, but as soon as finishes reading it, I get a Closing file Segmentation fault (core dumped)

How do I let libarchive move to reading the next tar file?

Upvotes: 0

Views: 262

Answers (1)

Algorithmatic
Algorithmatic

Reputation: 1892

Turns out the library supports this. Only need to set the read_concatenated_archives option set.

archive_read_set_options(a, "read_concatenated_archives")

see here for an example.

Upvotes: 0

Related Questions