summaryrefslogtreecommitdiff
path: root/libarchive/archive_read_support_format_cpio.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2009-09-24 11:06:56 -0400
committerTim Kientzle <kientzle@gmail.com>2009-09-24 11:06:56 -0400
commit835b0b1bf11cb59dca9390c67d005bf28935c073 (patch)
tree97d02d2d19bf2c036ab85a6eb3375ca24c62c230 /libarchive/archive_read_support_format_cpio.c
parent01fd4d71399f25d3726d34f6e56fc620f22e3b0b (diff)
downloadlibarchive-835b0b1bf11cb59dca9390c67d005bf28935c073.tar.gz
Use int64_t for storing inode values internally.
This fixes some hardlink-detection issues on Windows: NTFS uses 64-bit inode values, but Windows ino_t is only 16 bits. SVN-Revision: 1463
Diffstat (limited to 'libarchive/archive_read_support_format_cpio.c')
-rw-r--r--libarchive/archive_read_support_format_cpio.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/libarchive/archive_read_support_format_cpio.c b/libarchive/archive_read_support_format_cpio.c
index 104e7f6e..3c96ecfc 100644
--- a/libarchive/archive_read_support_format_cpio.c
+++ b/libarchive/archive_read_support_format_cpio.c
@@ -92,7 +92,7 @@ struct links_entry {
struct links_entry *previous;
int links;
dev_t dev;
- ino_t ino;
+ int64_t ino;
char *name;
};
@@ -727,48 +727,48 @@ atol16(const char *p, unsigned char_cnt)
static void
record_hardlink(struct cpio *cpio, struct archive_entry *entry)
{
- struct links_entry *le;
+ struct links_entry *le;
dev_t dev;
- ino_t ino;
+ int64_t ino;
dev = archive_entry_dev(entry);
- ino = archive_entry_ino(entry);
-
- /*
- * First look in the list of multiply-linked files. If we've
- * already dumped it, convert this entry to a hard link entry.
- */
- for (le = cpio->links_head; le; le = le->next) {
- if (le->dev == dev && le->ino == ino) {
- archive_entry_copy_hardlink(entry, le->name);
-
- if (--le->links <= 0) {
- if (le->previous != NULL)
- le->previous->next = le->next;
- if (le->next != NULL)
- le->next->previous = le->previous;
- if (cpio->links_head == le)
- cpio->links_head = le->next;
+ ino = archive_entry_ino64(entry);
+
+ /*
+ * First look in the list of multiply-linked files. If we've
+ * already dumped it, convert this entry to a hard link entry.
+ */
+ for (le = cpio->links_head; le; le = le->next) {
+ if (le->dev == dev && le->ino == ino) {
+ archive_entry_copy_hardlink(entry, le->name);
+
+ if (--le->links <= 0) {
+ if (le->previous != NULL)
+ le->previous->next = le->next;
+ if (le->next != NULL)
+ le->next->previous = le->previous;
+ if (cpio->links_head == le)
+ cpio->links_head = le->next;
free(le->name);
- free(le);
- }
+ free(le);
+ }
- return;
- }
- }
+ return;
+ }
+ }
- le = (struct links_entry *)malloc(sizeof(struct links_entry));
+ le = (struct links_entry *)malloc(sizeof(struct links_entry));
if (le == NULL)
__archive_errx(1, "Out of memory adding file to list");
- if (cpio->links_head != NULL)
- cpio->links_head->previous = le;
- le->next = cpio->links_head;
- le->previous = NULL;
- cpio->links_head = le;
- le->dev = dev;
- le->ino = ino;
- le->links = archive_entry_nlink(entry) - 1;
- le->name = strdup(archive_entry_pathname(entry));
+ if (cpio->links_head != NULL)
+ cpio->links_head->previous = le;
+ le->next = cpio->links_head;
+ le->previous = NULL;
+ cpio->links_head = le;
+ le->dev = dev;
+ le->ino = ino;
+ le->links = archive_entry_nlink(entry) - 1;
+ le->name = strdup(archive_entry_pathname(entry));
if (le->name == NULL)
__archive_errx(1, "Out of memory adding file to list");
}