libarchive-static 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (296) hide show
  1. checksums.yaml +5 -5
  2. data/ext/extconf.rb +2 -9
  3. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +6 -6
  4. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.o +0 -0
  5. data/ext/libarchive-0.1.1/ext/archive_read_support_format.o +0 -0
  6. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +1 -1
  7. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.o +0 -0
  8. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +5 -5
  9. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.o +0 -0
  10. data/ext/libarchive-0.1.1/ext/config.h +23 -0
  11. data/ext/libarchive-0.1.1/ext/config.log +230 -0
  12. data/ext/libarchive-0.1.1/ext/config.status +671 -0
  13. data/ext/libarchive-0.1.1/ext/libarchive.c +1 -1
  14. data/ext/libarchive-0.1.1/ext/libarchive.o +0 -0
  15. data/ext/libarchive-0.1.1/ext/libarchive_archive.c +7 -7
  16. data/ext/libarchive-0.1.1/ext/libarchive_archive.o +0 -0
  17. data/ext/libarchive-0.1.1/ext/libarchive_entry.c +6 -0
  18. data/ext/libarchive-0.1.1/ext/libarchive_entry.o +0 -0
  19. data/ext/libarchive-0.1.1/ext/libarchive_internal.h +0 -1
  20. data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
  21. data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
  22. data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
  23. data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
  24. data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
  25. data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
  26. data/ext/libarchive-3.6.2/Makefile.in +16892 -0
  27. data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
  28. data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
  29. data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
  30. data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
  31. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
  32. data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
  33. data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
  34. data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
  35. data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
  36. data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
  37. data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
  38. data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
  39. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
  40. data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
  41. data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
  42. data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
  43. data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
  44. data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
  45. data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
  46. data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
  47. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
  48. data/ext/libarchive-3.6.2/config.h.in +1504 -0
  49. data/ext/libarchive-3.6.2/configure +25558 -0
  50. data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
  51. data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
  52. data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
  53. data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
  54. data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
  55. data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
  56. data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
  57. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
  58. data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
  59. data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
  60. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
  61. data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
  62. data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
  63. data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
  64. data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
  65. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
  66. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
  67. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
  68. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
  69. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
  70. data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
  71. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
  72. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
  73. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
  74. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
  75. data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
  76. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
  77. data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
  78. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
  79. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
  80. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
  81. data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
  82. data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
  83. data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
  84. data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
  85. data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
  86. data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
  87. data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
  88. data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
  89. data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
  90. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
  91. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
  92. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
  93. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
  94. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
  95. data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
  96. data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
  97. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
  98. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
  99. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
  100. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
  101. data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
  102. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
  103. data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
  104. data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
  105. data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
  106. data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
  107. data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
  108. data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
  109. data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
  110. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
  111. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  112. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
  113. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
  114. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
  115. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
  116. data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
  117. data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
  118. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
  119. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
  120. data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
  121. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
  122. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
  123. data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
  124. data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
  125. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_all.c → libarchive-3.6.2/libarchive/archive_read_support_filter_all.c} +35 -10
  126. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
  127. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c → libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c} +38 -26
  128. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c → libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c} +52 -44
  129. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
  130. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c → libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c} +108 -37
  131. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
  132. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
  133. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
  134. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_none.c → libarchive-3.6.2/libarchive/archive_read_support_filter_none.c} +15 -3
  135. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_program.c → libarchive-3.6.2/libarchive/archive_read_support_filter_program.c} +114 -77
  136. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c → libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c} +31 -31
  137. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c → libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c} +141 -85
  138. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c → libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c} +369 -284
  139. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
  140. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
  141. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
  142. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
  143. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
  144. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
  145. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
  146. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
  147. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
  148. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
  149. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
  150. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
  151. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
  152. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
  153. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
  154. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
  155. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
  156. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
  157. data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
  158. data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
  159. data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
  160. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
  161. data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
  162. data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
  163. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
  164. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
  165. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
  166. data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
  167. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
  168. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
  169. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
  170. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
  171. data/ext/{libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c → libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c} +86 -131
  172. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
  173. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
  174. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
  175. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
  176. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
  177. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_format_all.c → libarchive-3.6.2/libarchive/archive_write_add_filter_none.c} +11 -11
  178. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
  179. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
  180. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
  181. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
  182. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
  183. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
  184. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
  185. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
  186. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
  187. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
  188. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
  189. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
  190. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
  191. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
  192. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
  193. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
  194. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
  195. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
  196. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
  197. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  198. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
  199. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
  200. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
  201. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
  202. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
  203. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
  204. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
  205. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
  206. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
  207. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
  208. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
  209. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
  210. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
  211. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
  212. data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
  213. data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
  214. data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
  215. data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
  216. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
  217. data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
  218. data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
  219. data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
  220. data/ext/libarchive-static-makefile +144 -80
  221. data/ext/libarchive-static-wrapper-makefile +1 -1
  222. data/ext/zlib-1.2.13/Makefile.in +404 -0
  223. data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
  224. data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
  225. data/ext/zlib-1.2.13/configure +922 -0
  226. data/ext/zlib-1.2.13/crc32.c +1125 -0
  227. data/ext/zlib-1.2.13/crc32.h +9446 -0
  228. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
  229. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
  230. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
  231. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
  232. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
  233. data/ext/zlib-1.2.13/gzread.c +650 -0
  234. data/ext/zlib-1.2.13/gzwrite.c +677 -0
  235. data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
  236. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
  237. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
  238. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
  239. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
  240. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
  241. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
  242. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
  243. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
  244. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
  245. data/ext/zlib-1.2.13/uncompr.c +93 -0
  246. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
  247. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
  248. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
  249. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
  250. metadata +244 -137
  251. data/ext/libarchive-0.1.1/libarchive.c +0 -1762
  252. data/ext/libarchive-2.8.4/Makefile.in +0 -7076
  253. data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
  254. data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
  255. data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
  256. data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
  257. data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
  258. data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
  259. data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
  260. data/ext/libarchive-2.8.4/config.h.in +0 -772
  261. data/ext/libarchive-2.8.4/configure +0 -17916
  262. data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
  263. data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
  264. data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
  265. data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
  266. data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
  267. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
  268. data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
  269. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
  270. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
  271. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
  272. data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
  273. data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
  274. data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
  275. data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
  276. data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
  277. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
  278. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
  279. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
  280. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
  281. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
  282. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
  283. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
  284. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
  285. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
  286. data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
  287. data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
  288. data/ext/zlib-1.2.5/Makefile.in +0 -257
  289. data/ext/zlib-1.2.5/configure +0 -596
  290. data/ext/zlib-1.2.5/crc32.c +0 -442
  291. data/ext/zlib-1.2.5/crc32.h +0 -441
  292. data/ext/zlib-1.2.5/example.c +0 -565
  293. data/ext/zlib-1.2.5/gzread.c +0 -653
  294. data/ext/zlib-1.2.5/gzwrite.c +0 -531
  295. data/ext/zlib-1.2.5/minigzip.c +0 -440
  296. data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -0,0 +1,610 @@
1
+ /*-
2
+ * Copyright (c) 2003-2007 Tim Kientzle
3
+ * Copyright (c) 2011-2012 Michihiro NAKAJIMA
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions
8
+ * are met:
9
+ * 1. Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+ */
26
+
27
+ #include "archive_platform.h"
28
+ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio.c 201170 2009-12-29 06:34:23Z kientzle $");
29
+
30
+ #ifdef HAVE_ERRNO_H
31
+ #include <errno.h>
32
+ #endif
33
+ #include <stdio.h>
34
+ #ifdef HAVE_STDLIB_H
35
+ #include <stdlib.h>
36
+ #endif
37
+ #ifdef HAVE_STRING_H
38
+ #include <string.h>
39
+ #endif
40
+
41
+ #include "archive.h"
42
+ #include "archive_entry.h"
43
+ #include "archive_entry_locale.h"
44
+ #include "archive_private.h"
45
+ #include "archive_write_private.h"
46
+ #include "archive_write_set_format_private.h"
47
+
48
+ static ssize_t archive_write_binary_data(struct archive_write *,
49
+ const void *buff, size_t s);
50
+ static int archive_write_binary_close(struct archive_write *);
51
+ static int archive_write_binary_free(struct archive_write *);
52
+ static int archive_write_binary_finish_entry(struct archive_write *);
53
+ static int archive_write_binary_header(struct archive_write *,
54
+ struct archive_entry *);
55
+ static int archive_write_binary_options(struct archive_write *,
56
+ const char *, const char *);
57
+ static int write_header(struct archive_write *, struct archive_entry *);
58
+
59
+ struct cpio {
60
+ uint64_t entry_bytes_remaining;
61
+
62
+ int64_t ino_next;
63
+
64
+ struct { int64_t old; int new;} *ino_list;
65
+ size_t ino_list_size;
66
+ size_t ino_list_next;
67
+
68
+ struct archive_string_conv *opt_sconv;
69
+ struct archive_string_conv *sconv_default;
70
+ int init_default_conversion;
71
+ };
72
+
73
+ /* This struct needs to be packed to get the header right */
74
+
75
+ #if defined(__GNUC__)
76
+ #define PACKED(x) x __attribute__((packed))
77
+ #elif defined(_MSC_VER)
78
+ #define PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
79
+ #else
80
+ #define PACKED(x) x
81
+ #endif
82
+
83
+ #define HSIZE 26
84
+
85
+ PACKED(struct cpio_binary_header {
86
+ uint16_t h_magic;
87
+ uint16_t h_dev;
88
+ uint16_t h_ino;
89
+ uint16_t h_mode;
90
+ uint16_t h_uid;
91
+ uint16_t h_gid;
92
+ uint16_t h_nlink;
93
+ uint16_t h_majmin;
94
+ uint32_t h_mtime;
95
+ uint16_t h_namesize;
96
+ uint32_t h_filesize;
97
+ });
98
+
99
+ /* Back in the day, the 7th Edition cpio.c had this, to
100
+ * adapt to, as the comment said, "VAX, Interdata, ...":
101
+ *
102
+ * union { long l; short s[2]; char c[4]; } U;
103
+ * #define MKSHORT(v,lv) {U.l=1L;if(U.c[0]) U.l=lv,v[0]=U.s[1],v[1]=U.s[0]; else U.l=lv,v[0]=U.s[0],v[1]=U.s[1];}
104
+ * long mklong(v)
105
+ * short v[];
106
+ * {
107
+ * U.l = 1;
108
+ * if(U.c[0])
109
+ * U.s[0] = v[1], U.s[1] = v[0];
110
+ * else
111
+ * U.s[0] = v[0], U.s[1] = v[1];
112
+ * return U.l;
113
+ * }
114
+ *
115
+ * Of course, that assumes that all machines have little-endian shorts,
116
+ * and just adapts the others to the special endianness of the PDP-11.
117
+ *
118
+ * Now, we could do this:
119
+ *
120
+ * union { uint32_t l; uint16_t s[2]; uint8_t c[4]; } U;
121
+ * #define PUTI16(v,sv) {U.s[0]=1;if(U.c[0]) v=sv; else U.s[0]=sv,U.c[2]=U.c[1],U.c[3]=U.c[0],v=U.s[1];}
122
+ * #define PUTI32(v,lv) {char_t Ut;U.l=1;if(U.c[0]) U.l=lv,v[0]=U.s[1],v[1]=U.s[0]; else U.l=lv,Ut=U.c[0],U.c[0]=U.c[1],U.c[1]=Ut,Ut=U.c[2],U.c[2]=U.c[3],U.c[3]=Ut,v[0]=U.s[0],v[1]=U.s[1];}
123
+ *
124
+ * ...but it feels a little better to do it like this:
125
+ */
126
+
127
+ static uint16_t la_swap16(uint16_t in) {
128
+ union {
129
+ uint16_t s[2];
130
+ uint8_t c[4];
131
+ } U;
132
+ U.s[0] = 1;
133
+ if (U.c[0])
134
+ return in;
135
+ else {
136
+ U.s[0] = in;
137
+ U.c[2] = U.c[1];
138
+ U.c[3] = U.c[0];
139
+ return U.s[1];
140
+ }
141
+ /* NOTREACHED */
142
+ }
143
+
144
+ static uint32_t la_swap32(uint32_t in) {
145
+ union {
146
+ uint32_t l;
147
+ uint16_t s[2];
148
+ uint8_t c[4];
149
+ } U;
150
+ U.l = 1;
151
+ if (U.c[0]) { /* Little-endian */
152
+ uint16_t t;
153
+ U.l = in;
154
+ t = U.s[0];
155
+ U.s[0] = U.s[1];
156
+ U.s[1] = t;
157
+ } else if (U.c[3]) { /* Big-endian */
158
+ U.l = in;
159
+ U.s[0] = la_swap16(U.s[0]);
160
+ U.s[1] = la_swap16(U.s[1]);
161
+ } else { /* PDP-endian */
162
+ U.l = in;
163
+ }
164
+ return U.l;
165
+ }
166
+
167
+ /*
168
+ * Set output format to the selected binary variant
169
+ */
170
+ static int
171
+ archive_write_set_format_cpio_binary(struct archive *_a, int format)
172
+ {
173
+ struct archive_write *a = (struct archive_write *)_a;
174
+ struct cpio *cpio;
175
+
176
+ if (sizeof(struct cpio_binary_header) != HSIZE) {
177
+ archive_set_error(&a->archive, EINVAL,
178
+ "Binary cpio format not supported on this platform");
179
+ return (ARCHIVE_FATAL);
180
+ }
181
+
182
+ archive_check_magic(_a, ARCHIVE_WRITE_MAGIC,
183
+ ARCHIVE_STATE_NEW, "archive_write_set_format_cpio_binary");
184
+
185
+ /* If someone else was already registered, unregister them. */
186
+ if (a->format_free != NULL)
187
+ (a->format_free)(a);
188
+
189
+ cpio = (struct cpio *)calloc(1, sizeof(*cpio));
190
+ if (cpio == NULL) {
191
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
192
+ return (ARCHIVE_FATAL);
193
+ }
194
+ a->format_data = cpio;
195
+ a->format_name = "cpio";
196
+ a->format_options = archive_write_binary_options;
197
+ a->format_write_header = archive_write_binary_header;
198
+ a->format_write_data = archive_write_binary_data;
199
+ a->format_finish_entry = archive_write_binary_finish_entry;
200
+ a->format_close = archive_write_binary_close;
201
+ a->format_free = archive_write_binary_free;
202
+ a->archive.archive_format = format;
203
+ switch (format) {
204
+ case ARCHIVE_FORMAT_CPIO_PWB:
205
+ a->archive.archive_format_name = "PWB cpio";
206
+ break;
207
+ case ARCHIVE_FORMAT_CPIO_BIN_LE:
208
+ a->archive.archive_format_name = "7th Edition cpio";
209
+ break;
210
+ default:
211
+ archive_set_error(&a->archive, EINVAL, "binary format must be 'pwb' or 'bin'");
212
+ return (ARCHIVE_FATAL);
213
+ }
214
+ return (ARCHIVE_OK);
215
+ }
216
+
217
+ /*
218
+ * Set output format to PWB (6th Edition) binary format
219
+ */
220
+ int
221
+ archive_write_set_format_cpio_pwb(struct archive *_a)
222
+ {
223
+ return archive_write_set_format_cpio_binary(_a, ARCHIVE_FORMAT_CPIO_PWB);
224
+ }
225
+
226
+ /*
227
+ * Set output format to 7th Edition binary format
228
+ */
229
+ int
230
+ archive_write_set_format_cpio_bin(struct archive *_a)
231
+ {
232
+ return archive_write_set_format_cpio_binary(_a, ARCHIVE_FORMAT_CPIO_BIN_LE);
233
+ }
234
+
235
+ static int
236
+ archive_write_binary_options(struct archive_write *a, const char *key,
237
+ const char *val)
238
+ {
239
+ struct cpio *cpio = (struct cpio *)a->format_data;
240
+ int ret = ARCHIVE_FAILED;
241
+
242
+ if (strcmp(key, "hdrcharset") == 0) {
243
+ if (val == NULL || val[0] == 0)
244
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
245
+ "%s: hdrcharset option needs a character-set name",
246
+ a->format_name);
247
+ else {
248
+ cpio->opt_sconv = archive_string_conversion_to_charset(
249
+ &a->archive, val, 0);
250
+ if (cpio->opt_sconv != NULL)
251
+ ret = ARCHIVE_OK;
252
+ else
253
+ ret = ARCHIVE_FATAL;
254
+ }
255
+ return (ret);
256
+ }
257
+
258
+ /* Note: The "warn" return is just to inform the options
259
+ * supervisor that we didn't handle it. It will generate
260
+ * a suitable error if no one used this option. */
261
+ return (ARCHIVE_WARN);
262
+ }
263
+
264
+ /*
265
+ * Ino values are as long as 64 bits on some systems; cpio format
266
+ * only allows 16 bits and relies on the ino values to identify hardlinked
267
+ * files. So, we can't merely "hash" the ino numbers since collisions
268
+ * would corrupt the archive. Instead, we generate synthetic ino values
269
+ * to store in the archive and maintain a map of original ino values to
270
+ * synthetic ones so we can preserve hardlink information.
271
+ *
272
+ * TODO: Make this more efficient. It's not as bad as it looks (most
273
+ * files don't have any hardlinks and we don't do any work here for those),
274
+ * but it wouldn't be hard to do better.
275
+ *
276
+ * TODO: Work with dev/ino pairs here instead of just ino values.
277
+ */
278
+ static int
279
+ synthesize_ino_value(struct cpio *cpio, struct archive_entry *entry)
280
+ {
281
+ int64_t ino = archive_entry_ino64(entry);
282
+ int ino_new;
283
+ size_t i;
284
+
285
+ /*
286
+ * If no index number was given, don't assign one. In
287
+ * particular, this handles the end-of-archive marker
288
+ * correctly by giving it a zero index value. (This is also
289
+ * why we start our synthetic index numbers with one below.)
290
+ */
291
+ if (ino == 0)
292
+ return (0);
293
+
294
+ /* Don't store a mapping if we don't need to. */
295
+ if (archive_entry_nlink(entry) < 2) {
296
+ return (int)(++cpio->ino_next);
297
+ }
298
+
299
+ /* Look up old ino; if we have it, this is a hardlink
300
+ * and we reuse the same value. */
301
+ for (i = 0; i < cpio->ino_list_next; ++i) {
302
+ if (cpio->ino_list[i].old == ino)
303
+ return (cpio->ino_list[i].new);
304
+ }
305
+
306
+ /* Assign a new index number. */
307
+ ino_new = (int)(++cpio->ino_next);
308
+
309
+ /* Ensure space for the new mapping. */
310
+ if (cpio->ino_list_size <= cpio->ino_list_next) {
311
+ size_t newsize = cpio->ino_list_size < 512
312
+ ? 512 : cpio->ino_list_size * 2;
313
+ void *newlist = realloc(cpio->ino_list,
314
+ sizeof(cpio->ino_list[0]) * newsize);
315
+ if (newlist == NULL)
316
+ return (-1);
317
+
318
+ cpio->ino_list_size = newsize;
319
+ cpio->ino_list = newlist;
320
+ }
321
+
322
+ /* Record and return the new value. */
323
+ cpio->ino_list[cpio->ino_list_next].old = ino;
324
+ cpio->ino_list[cpio->ino_list_next].new = ino_new;
325
+ ++cpio->ino_list_next;
326
+ return (ino_new);
327
+ }
328
+
329
+
330
+ static struct archive_string_conv *
331
+ get_sconv(struct archive_write *a)
332
+ {
333
+ struct cpio *cpio;
334
+ struct archive_string_conv *sconv;
335
+
336
+ cpio = (struct cpio *)a->format_data;
337
+ sconv = cpio->opt_sconv;
338
+ if (sconv == NULL) {
339
+ if (!cpio->init_default_conversion) {
340
+ cpio->sconv_default =
341
+ archive_string_default_conversion_for_write(
342
+ &(a->archive));
343
+ cpio->init_default_conversion = 1;
344
+ }
345
+ sconv = cpio->sconv_default;
346
+ }
347
+ return (sconv);
348
+ }
349
+
350
+ static int
351
+ archive_write_binary_header(struct archive_write *a, struct archive_entry *entry)
352
+ {
353
+ const char *path;
354
+ size_t len;
355
+
356
+ if (archive_entry_filetype(entry) == 0 && archive_entry_hardlink(entry) == NULL) {
357
+ archive_set_error(&a->archive, -1, "Filetype required");
358
+ return (ARCHIVE_FAILED);
359
+ }
360
+
361
+ if (archive_entry_pathname_l(entry, &path, &len, get_sconv(a)) != 0
362
+ && errno == ENOMEM) {
363
+ archive_set_error(&a->archive, ENOMEM,
364
+ "Can't allocate memory for Pathname");
365
+ return (ARCHIVE_FATAL);
366
+ }
367
+ if (len == 0 || path == NULL || path[0] == '\0') {
368
+ archive_set_error(&a->archive, -1, "Pathname required");
369
+ return (ARCHIVE_FAILED);
370
+ }
371
+
372
+ if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) < 0) {
373
+ archive_set_error(&a->archive, -1, "Size required");
374
+ return (ARCHIVE_FAILED);
375
+ }
376
+ return write_header(a, entry);
377
+ }
378
+
379
+ static int
380
+ write_header(struct archive_write *a, struct archive_entry *entry)
381
+ {
382
+ struct cpio *cpio;
383
+ const char *p, *path;
384
+ int pathlength, ret, ret_final;
385
+ int64_t ino;
386
+ struct cpio_binary_header h;
387
+ struct archive_string_conv *sconv;
388
+ struct archive_entry *entry_main;
389
+ size_t len;
390
+
391
+ cpio = (struct cpio *)a->format_data;
392
+ ret_final = ARCHIVE_OK;
393
+ sconv = get_sconv(a);
394
+
395
+ #if defined(_WIN32) && !defined(__CYGWIN__)
396
+ /* Make sure the path separators in pathname, hardlink and symlink
397
+ * are all slash '/', not the Windows path separator '\'. */
398
+ entry_main = __la_win_entry_in_posix_pathseparator(entry);
399
+ if (entry_main == NULL) {
400
+ archive_set_error(&a->archive, ENOMEM,
401
+ "Can't allocate ustar data");
402
+ return(ARCHIVE_FATAL);
403
+ }
404
+ if (entry != entry_main)
405
+ entry = entry_main;
406
+ else
407
+ entry_main = NULL;
408
+ #else
409
+ entry_main = NULL;
410
+ #endif
411
+
412
+ ret = archive_entry_pathname_l(entry, &path, &len, sconv);
413
+ if (ret != 0) {
414
+ if (errno == ENOMEM) {
415
+ archive_set_error(&a->archive, ENOMEM,
416
+ "Can't allocate memory for Pathname");
417
+ ret_final = ARCHIVE_FATAL;
418
+ goto exit_write_header;
419
+ }
420
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
421
+ "Can't translate pathname '%s' to %s",
422
+ archive_entry_pathname(entry),
423
+ archive_string_conversion_charset_name(sconv));
424
+ ret_final = ARCHIVE_WARN;
425
+ }
426
+ /* Include trailing null */
427
+ pathlength = (int)len + 1;
428
+
429
+ h.h_magic = la_swap16(070707);
430
+ h.h_dev = la_swap16(archive_entry_dev(entry));
431
+
432
+ ino = synthesize_ino_value(cpio, entry);
433
+ if (ino < 0) {
434
+ archive_set_error(&a->archive, ENOMEM,
435
+ "No memory for ino translation table");
436
+ ret_final = ARCHIVE_FATAL;
437
+ goto exit_write_header;
438
+ } else if (ino > 077777) {
439
+ archive_set_error(&a->archive, ERANGE,
440
+ "Too many files for this cpio format");
441
+ ret_final = ARCHIVE_FATAL;
442
+ goto exit_write_header;
443
+ }
444
+ h.h_ino = la_swap16((uint16_t)ino);
445
+
446
+ h.h_mode = archive_entry_mode(entry);
447
+ if (((h.h_mode & AE_IFMT) == AE_IFSOCK) || ((h.h_mode & AE_IFMT) == AE_IFIFO)) {
448
+ archive_set_error(&a->archive, EINVAL,
449
+ "sockets and fifos cannot be represented in the binary cpio formats");
450
+ ret_final = ARCHIVE_FATAL;
451
+ goto exit_write_header;
452
+ }
453
+ if (a->archive.archive_format == ARCHIVE_FORMAT_CPIO_PWB) {
454
+ if ((h.h_mode & AE_IFMT) == AE_IFLNK) {
455
+ archive_set_error(&a->archive, EINVAL,
456
+ "symbolic links cannot be represented in the PWB cpio format");
457
+ ret_final = ARCHIVE_FATAL;
458
+ goto exit_write_header;
459
+ }
460
+ /* we could turn off AE_IFREG here, but it does no harm, */
461
+ /* and allows v7 cpio to read the entry without confusion */
462
+ }
463
+ h.h_mode = la_swap16(h.h_mode);
464
+
465
+ h.h_uid = la_swap16((uint16_t)archive_entry_uid(entry));
466
+ h.h_gid = la_swap16((uint16_t)archive_entry_gid(entry));
467
+ h.h_nlink = la_swap16((uint16_t)archive_entry_nlink(entry));
468
+
469
+ if (archive_entry_filetype(entry) == AE_IFBLK
470
+ || archive_entry_filetype(entry) == AE_IFCHR)
471
+ h.h_majmin = la_swap16(archive_entry_rdev(entry));
472
+ else
473
+ h.h_majmin = 0;
474
+
475
+ h.h_mtime = la_swap32((uint32_t)archive_entry_mtime(entry));
476
+ h.h_namesize = la_swap16(pathlength);
477
+
478
+ /* Non-regular files don't store bodies. */
479
+ if (archive_entry_filetype(entry) != AE_IFREG)
480
+ archive_entry_set_size(entry, 0);
481
+
482
+ /* Symlinks get the link written as the body of the entry. */
483
+ ret = archive_entry_symlink_l(entry, &p, &len, sconv);
484
+ if (ret != 0) {
485
+ if (errno == ENOMEM) {
486
+ archive_set_error(&a->archive, ENOMEM,
487
+ "Can't allocate memory for Linkname");
488
+ ret_final = ARCHIVE_FATAL;
489
+ goto exit_write_header;
490
+ }
491
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
492
+ "Can't translate linkname '%s' to %s",
493
+ archive_entry_symlink(entry),
494
+ archive_string_conversion_charset_name(sconv));
495
+ ret_final = ARCHIVE_WARN;
496
+ }
497
+
498
+ if (len > 0 && p != NULL && *p != '\0') {
499
+ if (a->archive.archive_format == ARCHIVE_FORMAT_CPIO_PWB) {
500
+ archive_set_error(&a->archive, EINVAL,
501
+ "symlinks are not supported by UNIX V6 or by PWB cpio");
502
+ ret_final = ARCHIVE_FATAL;
503
+ goto exit_write_header;
504
+ }
505
+ h.h_filesize = la_swap32((uint32_t)strlen(p)); /* symlink */
506
+ } else {
507
+ if ((a->archive.archive_format == ARCHIVE_FORMAT_CPIO_PWB) &&
508
+ (archive_entry_size(entry) > 256*256*256-1)) {
509
+ archive_set_error(&a->archive, ERANGE,
510
+ "File is too large for PWB binary cpio format.");
511
+ ret_final = ARCHIVE_FAILED;
512
+ goto exit_write_header;
513
+ } else if (archive_entry_size(entry) > INT32_MAX) {
514
+ archive_set_error(&a->archive, ERANGE,
515
+ "File is too large for binary cpio format.");
516
+ ret_final = ARCHIVE_FAILED;
517
+ goto exit_write_header;
518
+ }
519
+ h.h_filesize = la_swap32((uint32_t)archive_entry_size(entry)); /* file */
520
+ }
521
+
522
+ ret = __archive_write_output(a, &h, HSIZE);
523
+ if (ret != ARCHIVE_OK) {
524
+ ret_final = ARCHIVE_FATAL;
525
+ goto exit_write_header;
526
+ }
527
+
528
+ ret = __archive_write_output(a, path, pathlength);
529
+ if ((ret == ARCHIVE_OK) && ((pathlength % 2) != 0))
530
+ ret = __archive_write_nulls(a, 1);
531
+ if (ret != ARCHIVE_OK) {
532
+ ret_final = ARCHIVE_FATAL;
533
+ goto exit_write_header;
534
+ }
535
+
536
+ cpio->entry_bytes_remaining = archive_entry_size(entry);
537
+ if ((cpio->entry_bytes_remaining % 2) != 0)
538
+ cpio->entry_bytes_remaining++;
539
+
540
+ /* Write the symlink now. */
541
+ if (p != NULL && *p != '\0') {
542
+ ret = __archive_write_output(a, p, strlen(p));
543
+ if ((ret == ARCHIVE_OK) && ((strlen(p) % 2) != 0))
544
+ ret = __archive_write_nulls(a, 1);
545
+ if (ret != ARCHIVE_OK) {
546
+ ret_final = ARCHIVE_FATAL;
547
+ goto exit_write_header;
548
+ }
549
+ }
550
+
551
+ exit_write_header:
552
+ archive_entry_free(entry_main);
553
+ return (ret_final);
554
+ }
555
+
556
+ static ssize_t
557
+ archive_write_binary_data(struct archive_write *a, const void *buff, size_t s)
558
+ {
559
+ struct cpio *cpio;
560
+ int ret;
561
+
562
+ cpio = (struct cpio *)a->format_data;
563
+ if (s > cpio->entry_bytes_remaining)
564
+ s = (size_t)cpio->entry_bytes_remaining;
565
+
566
+ ret = __archive_write_output(a, buff, s);
567
+ cpio->entry_bytes_remaining -= s;
568
+ if (ret >= 0)
569
+ return (s);
570
+ else
571
+ return (ret);
572
+ }
573
+
574
+ static int
575
+ archive_write_binary_close(struct archive_write *a)
576
+ {
577
+ int er;
578
+ struct archive_entry *trailer;
579
+
580
+ trailer = archive_entry_new2(NULL);
581
+ /* nlink = 1 here for GNU cpio compat. */
582
+ archive_entry_set_nlink(trailer, 1);
583
+ archive_entry_set_size(trailer, 0);
584
+ archive_entry_set_pathname(trailer, "TRAILER!!!");
585
+ er = write_header(a, trailer);
586
+ archive_entry_free(trailer);
587
+ return (er);
588
+ }
589
+
590
+ static int
591
+ archive_write_binary_free(struct archive_write *a)
592
+ {
593
+ struct cpio *cpio;
594
+
595
+ cpio = (struct cpio *)a->format_data;
596
+ free(cpio->ino_list);
597
+ free(cpio);
598
+ a->format_data = NULL;
599
+ return (ARCHIVE_OK);
600
+ }
601
+
602
+ static int
603
+ archive_write_binary_finish_entry(struct archive_write *a)
604
+ {
605
+ struct cpio *cpio;
606
+
607
+ cpio = (struct cpio *)a->format_data;
608
+ return (__archive_write_nulls(a,
609
+ (size_t)cpio->entry_bytes_remaining));
610
+ }