In save(), the archive_format of oldarc is fetched before any calls to archive_read_next_header have been made. According to the libarchive documentation, the format is determined by reading the archive headers. As a result, the archive format is 0 and its string name is "(null)". When this format is used to set the newarc format, the code defaults to ustar. When one mounts a cpio or cpio.gz archive, modifies files, and unmounts it, archiveformat replaces the original cpio archive with a tar archive.
In save(), the archive_format of oldarc is fetched before any calls to archive_read_next_header have been made. According to the libarchive documentation, the format is determined by reading the archive headers. As a result, the archive format is 0 and its string name is "(null)". When this format is used to set the newarc format, the code defaults to ustar. When one mounts a cpio or cpio.gz archive, modifies files, and unmounts it, archiveformat replaces the original cpio archive with a tar archive.