summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write_set_format_ustar.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_ustar.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_ustar.c')
-rw-r--r--lib/libarchive/archive_write_set_format_ustar.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libarchive/archive_write_set_format_ustar.c b/lib/libarchive/archive_write_set_format_ustar.c
index 42a4ce4..a7bd466 100644
--- a/lib/libarchive/archive_write_set_format_ustar.c
+++ b/lib/libarchive/archive_write_set_format_ustar.c
@@ -181,8 +181,10 @@ __archive_write_format_header_ustar(struct archive *a, char buff[512],
size_t copy_length;
const char *p, *pp;
const struct stat *st;
+ int mytartype;
ret = 0;
+ mytartype = -1;
memcpy(buff, &template_header, 512);
h = (struct archive_entry_header_ustar *)buff;
@@ -219,7 +221,9 @@ __archive_write_format_header_ustar(struct archive *a, char buff[512],
}
p = archive_entry_hardlink(entry);
- if(p == NULL)
+ if(p != NULL)
+ mytartype = '1';
+ else
p = archive_entry_symlink(entry);
if (p != NULL && p[0] != '\0') {
copy_length = strlen(p);
@@ -302,8 +306,8 @@ __archive_write_format_header_ustar(struct archive *a, char buff[512],
if (tartype >= 0) {
h->typeflag[0] = tartype;
- } else if (archive_entry_hardlink(entry) != NULL) {
- h->typeflag[0] = '1';
+ } else if (mytartype >= 0) {
+ h->typeflag[0] = mytartype;
} else {
switch (st->st_mode & S_IFMT) {
case S_IFREG: h->typeflag[0] = '0' ; break;
OpenPOWER on IntegriCloud