Fix compress support and prevent a segfault

This commit is contained in:
Glenn L McGrath
2002-09-27 06:46:02 +00:00
parent a47a3eada6
commit 2e41d0cb77
12 changed files with 71 additions and 66 deletions

View File

@@ -5,9 +5,8 @@
extern void check_header_gzip(int src_fd)
{
union {
unsigned char raw[10];
unsigned char raw[8];
struct {
unsigned char magic[2];
unsigned char method;
unsigned char flags;
unsigned int mtime;
@@ -16,13 +15,7 @@ extern void check_header_gzip(int src_fd)
} formated;
} header;
xread_all(src_fd, header.raw, 10);
/* Magic header for gzip files, 1F 8B = \037\213 */
if ((header.formated.magic[0] != 0x1F)
|| (header.formated.magic[1] != 0x8b)) {
error_msg_and_die("Invalid gzip magic");
}
xread_all(src_fd, header.raw, 8);
/* Check the compression method */
if (header.formated.method != 8) {