removed a lot of trailing \n in bb_msg() calls. It is added
[oweals/busybox.git] / archival / libunarchive / get_header_cpio.c
index f54b5af69b9dc3f726b213452748b54500e8b70c..bc766c6aafdf0bd8d0ed3c05259db51887e7b0b2 100644 (file)
@@ -1,15 +1,11 @@
+/* vi: set sw=4 ts=4: */
 /* Copyright 2002 Laurence Anderson
  *
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/sysmacros.h>     /* major() and minor() */
-#include "unarchive.h"
 #include "libbb.h"
+#include "unarchive.h"
 
 typedef struct hardlinks_s {
        file_header_t *entry;
@@ -35,7 +31,7 @@ char get_header_cpio(archive_handle_t *archive_handle)
                oldtmp = NULL;
 
                while (tmp) {
-                       bb_error_msg_and_die("need to fix this\n");
+                       bb_error_msg_and_die("need to fix this");
                        if (tmp->entry->link_name) { /* Found a hardlink ready to be extracted */
                                file_header = tmp->entry;
                                if (oldtmp) {
@@ -75,7 +71,8 @@ char get_header_cpio(archive_handle_t *archive_handle)
        }
 
        file_header->name = (char *) xzalloc(namesize + 1);
-       archive_xread_all(archive_handle, file_header->name, namesize); /* Read in filename */
+       /* Read in filename */
+       xread(archive_handle->src_fd, file_header->name, namesize);
        archive_handle->offset += namesize;
 
        /* Update offset amount and skip padding before file contents */
@@ -102,7 +99,7 @@ char get_header_cpio(archive_handle_t *archive_handle)
 
        if (S_ISLNK(file_header->mode)) {
                file_header->link_name = (char *) xzalloc(file_header->size + 1);
-               archive_xread_all(archive_handle, file_header->link_name, file_header->size);
+               xread(archive_handle->src_fd, file_header->link_name, file_header->size);
                archive_handle->offset += file_header->size;
                file_header->size = 0; /* Stop possible seeks in future */
        } else {
@@ -121,7 +118,7 @@ char get_header_cpio(archive_handle_t *archive_handle)
                        pending_hardlinks = 1;
                        while (tmp) {
                                if (tmp->inode == inode) {
-                                       tmp->entry->link_name = bb_xstrdup(file_header->name);
+                                       tmp->entry->link_name = xstrdup(file_header->name);
                                        nlink--;
                                }
                                tmp = tmp->next;