summaryrefslogtreecommitdiffstats
path: root/contrib/cpio
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-08-28 03:13:05 +0000
committerkientzle <kientzle@FreeBSD.org>2004-08-28 03:13:05 +0000
commitfb64ba1c5535ee3d115e446e628de5826c235ba6 (patch)
tree111c225f4584e1a266773499de8b37059caf3dda /contrib/cpio
parent826fb4fba8df15bfbfbb5075087aa35372540736 (diff)
downloadFreeBSD-src-fb64ba1c5535ee3d115e446e628de5826c235ba6.zip
FreeBSD-src-fb64ba1c5535ee3d115e446e628de5826c235ba6.tar.gz
Recognize and skip 'x' and 'g' pax extension entries. In particular,
this avoids the creation of "PaxHeader" dirs when unpacking pax-format tar archives such as those written by bsdtar. MFC after: 3 days
Diffstat (limited to 'contrib/cpio')
-rw-r--r--contrib/cpio/tar.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/contrib/cpio/tar.c b/contrib/cpio/tar.c
index 333ec20..832ad4f 100644
--- a/contrib/cpio/tar.c
+++ b/contrib/cpio/tar.c
@@ -15,6 +15,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+/* $FreeBSD$ */
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -343,6 +345,19 @@ read_in_tar_header (file_hdr, in_des)
else
file_hdr->c_mode |= CP_IFREG;
break;
+ case 'x': case 'g':
+ /* Ignore pax 'x' and 'g' extension entries. */
+ /* Skip body of this entry. */
+ while (file_hdr->c_filesize > 0) {
+ tape_buffered_read(((char *) &tar_rec), in_des, TARRECORDSIZE);
+ if (file_hdr->c_filesize > TARRECORDSIZE)
+ file_hdr->c_filesize -= TARRECORDSIZE;
+ else
+ file_hdr->c_filesize = 0;
+ }
+ /* Read next header and return that instead. */
+ read_in_tar_header(file_hdr, in_des);
+ break;
}
break;
}
OpenPOWER on IntegriCloud