static int is_octal(const char *, size_t);
static int is_hex(const char *, size_t);
static int le4(const unsigned char *);
-static int record_hardlink(struct cpio *cpio, struct archive_entry *entry);
+static int record_hardlink(struct archive_read *a,
+ struct cpio *cpio, struct archive_entry *entry);
int
archive_read_support_format_cpio(struct archive *_a)
}
/* Detect and record hardlinks to previously-extracted entries. */
- if (record_hardlink(cpio, entry) != ARCHIVE_OK) {
- archive_set_error(&a->archive,
- ENOMEM, "Out of memory adding file to list");
+ if (record_hardlink(a, cpio, entry) != ARCHIVE_OK) {
return (ARCHIVE_FATAL);
}
}
static int
-record_hardlink(struct cpio *cpio, struct archive_entry *entry)
+record_hardlink(struct archive_read *a,
+ struct cpio *cpio, struct archive_entry *entry)
{
struct links_entry *le;
dev_t dev;
}
le = (struct links_entry *)malloc(sizeof(struct links_entry));
- if (le == NULL)
+ if (le == NULL) {
+ archive_set_error(&a->archive,
+ ENOMEM, "Out of memory adding file to list");
return (ARCHIVE_FATAL);
+ }
if (cpio->links_head != NULL)
cpio->links_head->previous = le;
le->next = cpio->links_head;
le->ino = ino;
le->links = archive_entry_nlink(entry) - 1;
le->name = strdup(archive_entry_pathname(entry));
- if (le->name == NULL)
+ if (le->name == NULL) {
+ archive_set_error(&a->archive,
+ ENOMEM, "Out of memory adding file to list");
return (ARCHIVE_FATAL);
+ }
return (ARCHIVE_OK);
}