summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write_set_format_ustar.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libarchive/archive_write_set_format_ustar.c')
-rw-r--r--lib/libarchive/archive_write_set_format_ustar.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libarchive/archive_write_set_format_ustar.c b/lib/libarchive/archive_write_set_format_ustar.c
index 1a67a1d..649be5e 100644
--- a/lib/libarchive/archive_write_set_format_ustar.c
+++ b/lib/libarchive/archive_write_set_format_ustar.c
@@ -125,6 +125,13 @@ archive_write_ustar_header(struct archive *a, struct archive_entry *entry)
ustar = a->format_data;
ustar->written = 1;
+
+ /* Only regular files (not hardlinks) have data. */
+ if (archive_entry_hardlink(entry) != NULL ||
+ archive_entry_symlink(entry) != NULL ||
+ !S_ISREG(archive_entry_mode(entry)))
+ archive_entry_set_size(entry, 0);
+
ret = __archive_write_format_header_ustar(a, buff, entry);
if (ret != ARCHIVE_OK)
return (ret);
@@ -132,14 +139,7 @@ archive_write_ustar_header(struct archive *a, struct archive_entry *entry)
if (ret < 512)
return (ARCHIVE_FATAL);
- /* Only regular files (not hardlinks) have data. */
- if (archive_entry_hardlink(entry) != NULL ||
- archive_entry_symlink(entry) != NULL ||
- !S_ISREG(archive_entry_mode(entry)))
- ustar->entry_bytes_remaining = 0;
- else
- ustar->entry_bytes_remaining = archive_entry_size(entry);
-
+ ustar->entry_bytes_remaining = archive_entry_size(entry);
ustar->entry_padding = 0x1ff & (- ustar->entry_bytes_remaining);
return (ARCHIVE_OK);
}
OpenPOWER on IntegriCloud