summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Burridge <rich.burridge@sun.com>2010-03-25 13:21:39 -0700
committerRich Burridge <rich.burridge@sun.com>2010-03-25 13:21:39 -0700
commite765faef9c0385c419aa16d67aa529de3c41ac01 (patch)
treefab6f99b51da5f8a8581b7ffb182fb8d22b893af
parent874067a014d3e133de4f0636e5a615038cbca9b8 (diff)
downloadillumos-joyent-e765faef9c0385c419aa16d67aa529de3c41ac01.tar.gz
6202362 Solaris tar can't unpack files created with GNU tar
-rw-r--r--usr/src/cmd/tar/tar.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/usr/src/cmd/tar/tar.c b/usr/src/cmd/tar/tar.c
index e3abe73bad..4ab7b9c427 100644
--- a/usr/src/cmd/tar/tar.c
+++ b/usr/src/cmd/tar/tar.c
@@ -1543,10 +1543,11 @@ top:
break;
}
- if (dblock.dbuf.typeflag == 'X')
+ if ((dblock.dbuf.typeflag == 'X') || (dblock.dbuf.typeflag == 'L')) {
Xhdrflag = 1; /* Currently processing extended header */
- else
+ } else {
Xhdrflag = 0;
+ }
sp->st_uid = Gen.g_uid;
sp->st_gid = Gen.g_gid;
@@ -2722,6 +2723,7 @@ convtoreg(off_t size)
(dblock.dbuf.typeflag != '2') && (dblock.dbuf.typeflag != '3') &&
(dblock.dbuf.typeflag != '4') && (dblock.dbuf.typeflag != '5') &&
(dblock.dbuf.typeflag != '6') && (dblock.dbuf.typeflag != 'A') &&
+ (dblock.dbuf.typeflag != 'L') &&
(dblock.dbuf.typeflag != _XATTR_HDRTYPE) &&
(dblock.dbuf.typeflag != 'X')) {
return (1);
@@ -6753,7 +6755,7 @@ write_ancillary(union hblock *dblockp, char *secinfo, int len, char hdrtype)
/*
* Read the data record for extended headers and then the regular header.
* The data are read into the buffer and then null-terminated. Entries
- * are of the format:
+ * for typeflag 'X' extended headers are of the format:
* "%d %s=%s\n"
*
* When an extended header record is found, the extended header must
@@ -6810,11 +6812,17 @@ get_xdata(void)
lineloc = xrec_ptr;
xrec_ptr[stbuf.st_size] = '\0';
while (lineloc < xrec_ptr + stbuf.st_size) {
- length = atoi(lineloc);
- *(lineloc + length - 1) = '\0';
- keyword = strchr(lineloc, ' ') + 1;
- value = strchr(keyword, '=') + 1;
- *(value - 1) = '\0';
+ if (dblock.dbuf.typeflag == 'L') {
+ length = xrec_size;
+ keyword = "path";
+ value = lineloc;
+ } else {
+ length = atoi(lineloc);
+ *(lineloc + length - 1) = '\0';
+ keyword = strchr(lineloc, ' ') + 1;
+ value = strchr(keyword, '=') + 1;
+ *(value - 1) = '\0';
+ }
i = 0;
lineloc += length;
while (keylist_pair[i].keynum != (int)_X_LAST) {