Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/archival/libunarchive/check_header_gzip.c

    r821 r1765  
    1 #include <stdlib.h>
    2 #include <unistd.h>
     1/* vi: set sw=4 ts=4: */
     2/*
     3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     4 */
     5
    36#include "libbb.h"
    4 #include "unarchive.h" /* for external decl of check_header_gzip */
     7#include "unarchive.h" /* for external decl of check_header_gzip_or_die */
    58
    6 void check_header_gzip(int src_fd)
     9void check_header_gzip_or_die(int src_fd)
    710{
    811    union {
     
    1417            unsigned char xtra_flags;
    1518            unsigned char os_flags;
    16         } formated;
     19        } formatted;
    1720    } header;
    1821
    19     bb_xread_all(src_fd, header.raw, 8);
     22    xread(src_fd, header.raw, 8);
    2023
    2124    /* Check the compression method */
    22     if (header.formated.method != 8) {
    23         bb_error_msg_and_die("Unknown compression method %d",
    24                           header.formated.method);
     25    if (header.formatted.method != 8) {
     26        bb_error_msg_and_die("unknown compression method %d",
     27                          header.formatted.method);
    2528    }
    2629
    27     if (header.formated.flags & 0x04) {
     30    if (header.formatted.flags & 0x04) {
    2831        /* bit 2 set: extra field present */
    29         unsigned char extra_short;
     32        unsigned extra_short;
    3033
    31         extra_short = bb_xread_char(src_fd) + (bb_xread_char(src_fd) << 8);
     34        extra_short = xread_char(src_fd) + (xread_char(src_fd) << 8);
    3235        while (extra_short > 0) {
    3336            /* Ignore extra field */
    34             bb_xread_char(src_fd);
     37            xread_char(src_fd);
    3538            extra_short--;
    3639        }
     
    3841
    3942    /* Discard original name if any */
    40     if (header.formated.flags & 0x08) {
     43    if (header.formatted.flags & 0x08) {
    4144        /* bit 3 set: original file name present */
    42         while(bb_xread_char(src_fd) != 0);
     45        while (xread_char(src_fd) != 0);
    4346    }
    4447
    4548    /* Discard file comment if any */
    46     if (header.formated.flags & 0x10) {
     49    if (header.formatted.flags & 0x10) {
    4750        /* bit 4 set: file comment present */
    48         while(bb_xread_char(src_fd) != 0);
     51        while (xread_char(src_fd) != 0);
    4952    }
    5053
    5154    /* Read the header checksum */
    52     if (header.formated.flags & 0x02) {
    53         bb_xread_char(src_fd);
    54         bb_xread_char(src_fd);
     55    if (header.formatted.flags & 0x02) {
     56        xread_char(src_fd);
     57        xread_char(src_fd);
    5558    }
    56 
    57     return;
    5859}
Note: See TracChangeset for help on using the changeset viewer.