Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/archival/rpm2cpio.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/archival/rpm2cpio.c
r821 r1770 5 5 * Copyright (C) 2001 by Laurence Anderson 6 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 20 8 */ 21 #include <sys/types.h> 22 #include <netinet/in.h> /* For ntohl & htonl function */ 23 #include <fcntl.h> 24 #include <unistd.h> 25 #include <string.h> 26 #include "busybox.h" 9 #include "libbb.h" 27 10 #include "unarchive.h" 28 11 … … 53 36 struct rpm_header header; 54 37 55 bb_xread_all(rpm_fd, &header, sizeof(struct rpm_header));38 xread(rpm_fd, &header, sizeof(struct rpm_header)); 56 39 if (strncmp((char *) &header.magic, RPM_HEADER_MAGIC, 3) != 0) { 57 bb_error_msg_and_die(" Invalid RPM header magic"); /* Invalid magic */40 bb_error_msg_and_die("invalid RPM header magic"); /* Invalid magic */ 58 41 } 59 42 if (header.version != 1) { 60 bb_error_msg_and_die(" Unsupported RPM header version"); /* This program only supports v1 headers */43 bb_error_msg_and_die("unsupported RPM header version"); /* This program only supports v1 headers */ 61 44 } 62 45 header.entries = ntohl(header.entries); … … 67 50 68 51 /* No getopt required */ 52 int rpm2cpio_main(int argc, char **argv); 69 53 int rpm2cpio_main(int argc, char **argv) 70 54 { … … 76 60 rpm_fd = STDIN_FILENO; 77 61 } else { 78 rpm_fd = bb_xopen(argv[1], O_RDONLY);62 rpm_fd = xopen(argv[1], O_RDONLY); 79 63 } 80 64 81 bb_xread_all(rpm_fd, &lead, sizeof(struct rpm_lead));65 xread(rpm_fd, &lead, sizeof(struct rpm_lead)); 82 66 if (strncmp((char *) &lead.magic, RPM_MAGIC, 4) != 0) { 83 bb_error_msg_and_die(" Invalid RPM magic"); /* Just check the magic, the rest is irrelevant */67 bb_error_msg_and_die("invalid RPM magic"); /* Just check the magic, the rest is irrelevant */ 84 68 } 85 69 … … 91 75 skip_header(rpm_fd); 92 76 93 bb_xread_all(rpm_fd, &magic, 2);77 xread(rpm_fd, &magic, 2); 94 78 if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) { 95 bb_error_msg_and_die(" Invalid gzip magic");79 bb_error_msg_and_die("invalid gzip magic"); 96 80 } 97 81 98 check_header_gzip (rpm_fd);99 if ( inflate_gunzip(rpm_fd, STDOUT_FILENO) !=0) {100 bb_error_msg(" Error inflating");82 check_header_gzip_or_die(rpm_fd); 83 if (unpack_gz_stream(rpm_fd, STDOUT_FILENO) < 0) { 84 bb_error_msg("error inflating"); 101 85 } 102 86
Note:
See TracChangeset
for help on using the changeset viewer.