summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write_set_format_pax.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-04-20 20:07:30 +0000
committerkientzle <kientzle@FreeBSD.org>2004-04-20 20:07:30 +0000
commitd880d2509a8936d90944d9ff6fe5f5ea8d40d5d4 (patch)
treeb7eac822c0c2d1a67aa0aa585984384e7736493a /lib/libarchive/archive_write_set_format_pax.c
parentaef0c8e553ff57b37b0d39987fb578f8da54403a (diff)
downloadFreeBSD-src-d880d2509a8936d90944d9ff6fe5f5ea8d40d5d4.zip
FreeBSD-src-d880d2509a8936d90944d9ff6fe5f5ea8d40d5d4.tar.gz
Eliminate some redundant calls to archive_entry_hardlink.
Diffstat (limited to 'lib/libarchive/archive_write_set_format_pax.c')
-rw-r--r--lib/libarchive/archive_write_set_format_pax.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libarchive/archive_write_set_format_pax.c b/lib/libarchive/archive_write_set_format_pax.c
index efa38e2..bd7d3b2 100644
--- a/lib/libarchive/archive_write_set_format_pax.c
+++ b/lib/libarchive/archive_write_set_format_pax.c
@@ -315,6 +315,7 @@ archive_write_pax_header(struct archive *a,
{
struct archive_entry *entry_main;
const char *linkname, *p;
+ const char *hardlink;
const wchar_t *wp, *wp2, *wname_start;
int need_extension, oldstate, r, ret;
struct pax *pax;
@@ -332,8 +333,10 @@ archive_write_pax_header(struct archive *a,
st_original = archive_entry_stat(entry_original);
+ hardlink = archive_entry_hardlink(entry_original);
+
/* Make sure this is a type of entry that we can handle here */
- if (!archive_entry_hardlink(entry_original)) {
+ if (hardlink == NULL) {
switch (st_original->st_mode & S_IFMT) {
case S_IFREG:
case S_IFLNK:
@@ -390,13 +393,13 @@ archive_write_pax_header(struct archive *a,
}
/* If link name is too long, add 'linkpath' to pax extended attrs. */
- linkname = archive_entry_hardlink(entry_main);
+ linkname = hardlink;
if (linkname == NULL)
linkname = archive_entry_symlink(entry_main);
if (linkname != NULL && strlen(linkname) > 100) {
add_pax_attr(&(pax->pax_header), "linkpath", linkname);
- if (archive_entry_hardlink(entry_main))
+ if (hardlink != NULL)
archive_entry_set_hardlink(entry_main,
"././@LongHardLink");
else
@@ -563,7 +566,7 @@ archive_write_pax_header(struct archive *a,
* to improve compatibility with ustar.
*/
if (a->archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE &&
- archive_entry_hardlink(entry_main) != NULL)
+ hardlink != NULL)
archive_entry_set_size(entry_main, 0);
/*
@@ -576,7 +579,7 @@ archive_write_pax_header(struct archive *a,
* need to select this behavior, in which case the following
* will need to be revisited. XXX
*/
- if (archive_entry_hardlink(entry_main) != NULL)
+ if (hardlink != NULL)
archive_entry_set_size(entry_main, 0);
/* Format 'ustar' header for main entry. */
OpenPOWER on IntegriCloud