summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2004-05-19 17:09:24 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2004-05-19 17:09:24 +0000
commit22a2730797c4a20403961b827fdd43e62ffc7010 (patch)
treec06cdbe6fd20563b1cb435d59ca4e1c9c88b2489 /lib
parent86939604792d4259e774a0046b95c74162a819a9 (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libarchive/archive_read_support_format_tar.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libarchive/archive_read_support_format_tar.c b/lib/libarchive/archive_read_support_format_tar.c
index d4d31e55dc74..ebe0a8102ee7 100644
--- a/lib/libarchive/archive_read_support_format_tar.c
+++ b/lib/libarchive/archive_read_support_format_tar.c
@@ -764,21 +764,21 @@ header_ustar(struct archive *a, struct tar *tar, struct archive_entry *entry,
struct stat *st, const void *h)
{
const struct archive_entry_header_ustar *header;
+ struct archive_string *as;
header = h;
/* Copy name into an internal buffer to ensure null-termination. */
+ as = &(tar->entry_name);
if (header->prefix[0]) {
- archive_strncpy(&(tar->entry_name), header->prefix,
- sizeof(header->prefix));
- archive_strappend_char(&(tar->entry_name), '/');
- archive_strncat(&(tar->entry_name), header->name,
- sizeof(header->name));
+ archive_strncpy(as, header->prefix, sizeof(header->prefix));
+ if (as->s[archive_strlen(as) - 1] != '/')
+ archive_strappend_char(as, '/');
+ archive_strncat(as, header->name, sizeof(header->name));
} else
- archive_strncpy(&(tar->entry_name), header->name,
- sizeof(header->name));
+ archive_strncpy(as, header->name, sizeof(header->name));
- archive_entry_set_pathname(entry, tar->entry_name.s);
+ archive_entry_set_pathname(entry, as->s);
/* Handle rest of common fields. */
header_common(a, tar, entry, st, h);