4 #include "unarchive.h" /* for external decl of check_header_gzip */
6 void check_header_gzip(int src_fd)
14 unsigned char xtra_flags;
15 unsigned char os_flags;
19 bb_xread_all(src_fd, header.raw, 8);
21 /* Check the compression method */
22 if (header.formated.method != 8) {
23 bb_error_msg_and_die("Unknown compression method %d",
24 header.formated.method);
27 if (header.formated.flags & 0x04) {
28 /* bit 2 set: extra field present */
29 unsigned char extra_short;
31 extra_short = bb_xread_char(src_fd) + (bb_xread_char(src_fd) << 8);
32 while (extra_short > 0) {
33 /* Ignore extra field */
34 bb_xread_char(src_fd);
39 /* Discard original name if any */
40 if (header.formated.flags & 0x08) {
41 /* bit 3 set: original file name present */
42 while(bb_xread_char(src_fd) != 0);
45 /* Discard file comment if any */
46 if (header.formated.flags & 0x10) {
47 /* bit 4 set: file comment present */
48 while(bb_xread_char(src_fd) != 0);
51 /* Read the header checksum */
52 if (header.formated.flags & 0x02) {
53 bb_xread_char(src_fd);
54 bb_xread_char(src_fd);