diff options
Diffstat (limited to 'src/libs/3rdparty/libarchive/archive_read_support_format_cpio.c')
-rw-r--r-- | src/libs/3rdparty/libarchive/archive_read_support_format_cpio.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libs/3rdparty/libarchive/archive_read_support_format_cpio.c b/src/libs/3rdparty/libarchive/archive_read_support_format_cpio.c index 1c96e6ac1..6b8ae33a4 100644 --- a/src/libs/3rdparty/libarchive/archive_read_support_format_cpio.c +++ b/src/libs/3rdparty/libarchive/archive_read_support_format_cpio.c @@ -185,6 +185,8 @@ struct cpio { struct archive_string_conv *opt_sconv; struct archive_string_conv *sconv_default; int init_default_conversion; + + int option_pwb; }; static int64_t atol16(const char *, unsigned); @@ -343,6 +345,10 @@ archive_read_format_cpio_options(struct archive_read *a, ret = ARCHIVE_FATAL; } return (ret); + } else if (strcmp(key, "pwb") == 0) { + if (val != NULL && val[0] != 0) + cpio->option_pwb = 1; + return (ARCHIVE_OK); } /* Note: The "warn" return is just to inform the options @@ -891,6 +897,12 @@ header_bin_le(struct archive_read *a, struct cpio *cpio, archive_entry_set_dev(entry, header[bin_dev_offset] + header[bin_dev_offset + 1] * 256); archive_entry_set_ino(entry, header[bin_ino_offset] + header[bin_ino_offset + 1] * 256); archive_entry_set_mode(entry, header[bin_mode_offset] + header[bin_mode_offset + 1] * 256); + if (cpio->option_pwb) { + /* turn off random bits left over from V6 inode */ + archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777); + if ((archive_entry_mode(entry) & AE_IFMT) == 0) + archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG); + } archive_entry_set_uid(entry, header[bin_uid_offset] + header[bin_uid_offset + 1] * 256); archive_entry_set_gid(entry, header[bin_gid_offset] + header[bin_gid_offset + 1] * 256); archive_entry_set_nlink(entry, header[bin_nlink_offset] + header[bin_nlink_offset + 1] * 256); @@ -930,6 +942,12 @@ header_bin_be(struct archive_read *a, struct cpio *cpio, archive_entry_set_dev(entry, header[bin_dev_offset] * 256 + header[bin_dev_offset + 1]); archive_entry_set_ino(entry, header[bin_ino_offset] * 256 + header[bin_ino_offset + 1]); archive_entry_set_mode(entry, header[bin_mode_offset] * 256 + header[bin_mode_offset + 1]); + if (cpio->option_pwb) { + /* turn off random bits left over from V6 inode */ + archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777); + if ((archive_entry_mode(entry) & AE_IFMT) == 0) + archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG); + } archive_entry_set_uid(entry, header[bin_uid_offset] * 256 + header[bin_uid_offset + 1]); archive_entry_set_gid(entry, header[bin_gid_offset] * 256 + header[bin_gid_offset + 1]); archive_entry_set_nlink(entry, header[bin_nlink_offset] * 256 + header[bin_nlink_offset + 1]); |