]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Provide a hook for unsetting the size field.
authorTim Kientzle <kientzle@gmail.com>
Sat, 26 Jul 2008 21:17:48 +0000 (17:17 -0400)
committerTim Kientzle <kientzle@gmail.com>
Sat, 26 Jul 2008 21:17:48 +0000 (17:17 -0400)
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
libarchive/archive_entry.h
libarchive/archive_entry_link_resolver.c

index b0bbdd3c12d77ebbe807bba3bad59b486c558342..a8b0f5ba5fd028f16636de2b9688ac56b97d6691 100644 (file)
@@ -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)
 {
index 91239f2c1e56e3f8c1e1252073d6c35dcf201e39..f409cbd8a524832f3c38176c4206a8a9ff335843 100644 (file)
@@ -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 *);
index 4deee260d498891030d911be5dbcd63d505ead9e..6f3069cc646b1f7b6d7f8582c6e8616deca1d593 100644 (file)
@@ -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