Magellan Linux

Contents of /trunk/mkinitrd-magellan/busybox/archival/libunarchive/get_header_tar_gz.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File MIME type: text/plain
File size: 756 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 /* vi: set sw=4 ts=4: */
2 /*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
4 */
5
6 #include <stdlib.h>
7
8 #include "libbb.h"
9 #include "unarchive.h"
10
11 char get_header_tar_gz(archive_handle_t *archive_handle)
12 {
13 unsigned char magic[2];
14
15 /* Can't lseek over pipes */
16 archive_handle->seek = seek_by_read;
17
18 xread(archive_handle->src_fd, &magic, 2);
19 if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
20 bb_error_msg_and_die("invalid gzip magic");
21 }
22
23 check_header_gzip(archive_handle->src_fd);
24
25 archive_handle->src_fd = open_transformer(archive_handle->src_fd, inflate_gunzip);
26 archive_handle->offset = 0;
27 while (get_header_tar(archive_handle) == EXIT_SUCCESS) /**/;
28
29 /* Can only do one file at a time */
30 return EXIT_FAILURE;
31 }