Merge topic 'fix-libarchive-gnutar-large-ids'

ad194ae0 libarchive: Use base-256 encoding for UID/GID like GNU tar does
This commit is contained in:
Brad King 2015-04-09 14:28:23 -04:00 committed by CMake Topic Stage
commit bb891710cf
1 changed files with 6 additions and 6 deletions

View File

@ -644,18 +644,18 @@ archive_format_gnutar_header(struct archive_write *a, char h[512],
format_octal(archive_entry_mode(entry) & 07777, format_octal(archive_entry_mode(entry) & 07777,
h + GNUTAR_mode_offset, GNUTAR_mode_size); h + GNUTAR_mode_offset, GNUTAR_mode_size);
/* TODO: How does GNU tar handle large UIDs? */ /* GNU tar supports base-256 here, so should never overflow. */
if (format_octal(archive_entry_uid(entry), if (format_number(archive_entry_uid(entry), h + GNUTAR_uid_offset,
h + GNUTAR_uid_offset, GNUTAR_uid_size)) { GNUTAR_uid_size, GNUTAR_uid_max_size)) {
archive_set_error(&a->archive, ERANGE, archive_set_error(&a->archive, ERANGE,
"Numeric user ID %jd too large", "Numeric user ID %jd too large",
(intmax_t)archive_entry_uid(entry)); (intmax_t)archive_entry_uid(entry));
ret = ARCHIVE_FAILED; ret = ARCHIVE_FAILED;
} }
/* TODO: How does GNU tar handle large GIDs? */ /* GNU tar supports base-256 here, so should never overflow. */
if (format_octal(archive_entry_gid(entry), if (format_number(archive_entry_gid(entry), h + GNUTAR_gid_offset,
h + GNUTAR_gid_offset, GNUTAR_gid_size)) { GNUTAR_gid_size, GNUTAR_gid_max_size)) {
archive_set_error(&a->archive, ERANGE, archive_set_error(&a->archive, ERANGE,
"Numeric group ID %jd too large", "Numeric group ID %jd too large",
(intmax_t)archive_entry_gid(entry)); (intmax_t)archive_entry_gid(entry));