summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_read_support_format_iso9660.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2007-12-30 04:58:22 +0000
committerkientzle <kientzle@FreeBSD.org>2007-12-30 04:58:22 +0000
commit2b8395148ff378e52a5e00c0d2ac0123258b759b (patch)
tree743c28601a2502c30676ab2adfbbb665fa3f38b7 /lib/libarchive/archive_read_support_format_iso9660.c
parentb1a3a611be764b44dbdd47a17ec5076bcfbe6e88 (diff)
downloadFreeBSD-src-2b8395148ff378e52a5e00c0d2ac0123258b759b.zip
FreeBSD-src-2b8395148ff378e52a5e00c0d2ac0123258b759b.tar.gz
Update libarchive to 2.4.10. This includes a number of improvements
that I've been working on but put off committing until after the RELENG_7 branch, including: * New manpages: cpio.5 mtree.5 * New archive_entry_strmode() * New archive_entry_link_resolver() * New read support: mtree format * Internal API change: read format auction only runs once * Running the auction only once allowed simplifying a lot of bid logic. * Cpio robustness: search for next header after a sync error * Support device nodes on ISO9660 images * Eliminate a lot of unnecessary copies for uncompressed archives * Corrected handling of new GNU --sparse --posix formats * Correctly handle a zero-byte write to a compressed archive * Fixed memory leaks Many of these improvements were motivated by the upcoming bsdcpio front-end. There have also been extensive improvements to the libarchive_test test harness, which I'll commit separately.
Diffstat (limited to 'lib/libarchive/archive_read_support_format_iso9660.c')
-rw-r--r--lib/libarchive/archive_read_support_format_iso9660.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/libarchive/archive_read_support_format_iso9660.c b/lib/libarchive/archive_read_support_format_iso9660.c
index 9e3785c..83e2287 100644
--- a/lib/libarchive/archive_read_support_format_iso9660.c
+++ b/lib/libarchive/archive_read_support_format_iso9660.c
@@ -181,6 +181,7 @@ struct file_info {
time_t mtime; /* File last modified time. */
time_t atime; /* File last accessed time. */
time_t ctime; /* File creation time. */
+ uint64_t rdev; /* Device number */
mode_t mode;
uid_t uid;
gid_t gid;
@@ -194,7 +195,6 @@ struct file_info {
struct iso9660 {
int magic;
#define ISO9660_MAGIC 0x96609660
- int bid; /* If non-zero, return this as our bid. */
struct archive_string pathname;
char seenRockridge; /* Set true if RR extensions are used. */
unsigned char suspOffset;
@@ -255,7 +255,6 @@ archive_read_support_format_iso9660(struct archive *_a)
}
memset(iso9660, 0, sizeof(*iso9660));
iso9660->magic = ISO9660_MAGIC;
- iso9660->bid = -1; /* We haven't yet bid. */
r = __archive_read_register_format(a,
iso9660,
@@ -280,12 +279,10 @@ archive_read_format_iso9660_bid(struct archive_read *a)
ssize_t bytes_read;
const void *h;
const unsigned char *p;
+ int bid;
iso9660 = (struct iso9660 *)(a->format->data);
- if (iso9660->bid >= 0)
- return (iso9660->bid);
-
/*
* Skip the first 32k (reserved area) and get the first
* 8 sectors of the volume descriptor table. Of course,
@@ -293,7 +290,7 @@ archive_read_format_iso9660_bid(struct archive_read *a)
*/
bytes_read = (a->decompressor->read_ahead)(a, &h, 32768 + 8*2048);
if (bytes_read < 32768 + 8*2048)
- return (iso9660->bid = -1);
+ return (-1);
p = (const unsigned char *)h;
/* Skip the reserved area. */
@@ -302,16 +299,15 @@ archive_read_format_iso9660_bid(struct archive_read *a)
/* Check each volume descriptor to locate the PVD. */
for (; bytes_read > 2048; bytes_read -= 2048, p += 2048) {
- iso9660->bid = isPVD(iso9660, p);
- if (iso9660->bid > 0)
- return (iso9660->bid);
+ bid = isPVD(iso9660, p);
+ if (bid > 0)
+ return (bid);
if (*p == '\177') /* End-of-volume-descriptor marker. */
break;
}
/* We didn't find a valid PVD; return a bid of zero. */
- iso9660->bid = 0;
- return (iso9660->bid);
+ return (0);
}
static int
@@ -365,6 +361,8 @@ archive_read_format_iso9660_read_header(struct archive_read *a,
archive_entry_set_mtime(entry, file->mtime, 0);
archive_entry_set_ctime(entry, file->ctime, 0);
archive_entry_set_atime(entry, file->atime, 0);
+ /* N.B.: Rock Ridge supports 64-bit device numbers. */
+ archive_entry_set_rdev(entry, (dev_t)file->rdev);
archive_entry_set_size(entry, iso9660->entry_bytes_remaining);
archive_string_empty(&iso9660->pathname);
archive_entry_set_pathname(entry,
@@ -680,6 +678,14 @@ parse_rockridge(struct iso9660 *iso9660, struct file_info *file,
*/
break;
}
+ if (p[0] == 'P' && p[1] == 'N' && version == 1) {
+ if (data_length == 16) {
+ file->rdev = toi(data,4);
+ file->rdev <<= 32;
+ file->rdev |= toi(data + 8, 4);
+ }
+ break;
+ }
if (p[0] == 'P' && p[1] == 'X' && version == 1) {
/*
* PX extension comprises:
OpenPOWER on IntegriCloud