From f26dacb29edc210e18004b12d2141265a584ed22 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Tue, 14 Feb 2006 04:00:14 +0000 Subject: [PATCH] Extract device number information from SVR4 CPIO archives. Without this, you cannot properly restore device node entries from such archives. Thanks to: Steve 'dillo Okay for reporting this oversight. --- lib/libarchive/archive_read_support_format_cpio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libarchive/archive_read_support_format_cpio.c b/lib/libarchive/archive_read_support_format_cpio.c index 65b4316492e6..946a74ee55d6 100644 --- a/lib/libarchive/archive_read_support_format_cpio.c +++ b/lib/libarchive/archive_read_support_format_cpio.c @@ -336,11 +336,17 @@ header_newc(struct archive *a, struct cpio *cpio, struct stat *st, /* TODO: Abort here? */ } + st->st_dev = makedev( + atol16(header->c_devmajor, sizeof(header->c_devmajor)), + atol16(header->c_devminor, sizeof(header->c_devminor))); st->st_ino = atol16(header->c_ino, sizeof(header->c_ino)); st->st_mode = atol16(header->c_mode, sizeof(header->c_mode)); st->st_uid = atol16(header->c_uid, sizeof(header->c_uid)); st->st_gid = atol16(header->c_gid, sizeof(header->c_gid)); st->st_nlink = atol16(header->c_nlink, sizeof(header->c_nlink)); + st->st_rdev = makedev( + atol16(header->c_rdevmajor, sizeof(header->c_rdevmajor)), + atol16(header->c_rdevminor, sizeof(header->c_rdevminor))); st->st_mtime = atol16(header->c_mtime, sizeof(header->c_mtime)); *namelength = atol16(header->c_namesize, sizeof(header->c_namesize)); /* Pad name to 2 more than a multiple of 4. */