From 1480be9f2dcda13debcb587f8e839d61015fba8e Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sat, 26 Jul 2008 17:17:48 -0400 Subject: [PATCH] Provide a hook for unsetting the size field. Use it in the link resolver for correctly marking hard links where the size of the linked-to file is actually unknown. SVN-Revision: 167 --- libarchive/archive_entry.c | 7 +++++++ libarchive/archive_entry.h | 1 + libarchive/archive_entry_link_resolver.c | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c index b0bbdd3c1..a8b0f5ba5 100644 --- a/libarchive/archive_entry.c +++ b/libarchive/archive_entry.c @@ -975,6 +975,13 @@ archive_entry_set_size(struct archive_entry *entry, int64_t s) entry->ae_set |= AE_SET_SIZE; } +void +archive_entry_unset_size(struct archive_entry *entry) +{ + archive_entry_set_size(entry, 0); + entry->ae_set &= ~AE_SET_SIZE; +} + void archive_entry_copy_sourcepath(struct archive_entry *entry, const char *path) { diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h index 91239f2c1..f409cbd8a 100644 --- a/libarchive/archive_entry.h +++ b/libarchive/archive_entry.h @@ -257,6 +257,7 @@ __LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_size(struct archive_entry *, int64_t); +__LA_DECL void archive_entry_unset_size(struct archive_entry *); __LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *); diff --git a/libarchive/archive_entry_link_resolver.c b/libarchive/archive_entry_link_resolver.c index 4deee260d..6f3069cc6 100644 --- a/libarchive/archive_entry_link_resolver.c +++ b/libarchive/archive_entry_link_resolver.c @@ -189,7 +189,7 @@ archive_entry_linkify(struct archive_entry_linkresolver *res, case ARCHIVE_ENTRY_LINKIFY_LIKE_TAR: le = find_entry(res, *e); if (le != NULL) { - archive_entry_set_size(*e, 0); + archive_entry_unset_size(*e); archive_entry_copy_hardlink(*e, archive_entry_pathname(le->canonical)); } else @@ -217,7 +217,7 @@ archive_entry_linkify(struct archive_entry_linkresolver *res, *e = le->entry; le->entry = t; /* Make the old entry into a hardlink. */ - archive_entry_set_size(*e, 0); + archive_entry_unset_size(*e); archive_entry_copy_hardlink(*e, archive_entry_pathname(le->canonical)); /* If we ran out of links, return the -- 2.47.3