summaryrefslogtreecommitdiff
path: root/archival/libunarchive
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-07-26 09:11:12 +0000
committerEric Andersen <andersen@codepoet.org>2004-07-26 09:11:12 +0000
commit4f807a84c5d936c931cd93c9e98d087305295a1c (patch)
tree46c3a59fa158ebbd7303454f2657c330abfc24fe /archival/libunarchive
parent5dcf15e02de10e648ac8e8d86500678f2043d2e6 (diff)
downloadbusybox-w32-4f807a84c5d936c931cd93c9e98d087305295a1c.tar.gz
busybox-w32-4f807a84c5d936c931cd93c9e98d087305295a1c.tar.bz2
busybox-w32-4f807a84c5d936c931cd93c9e98d087305295a1c.zip
BusyBox has no business hard coding the number of major and minor bits for a
dev_t. This is especially important now that the user space concept of a dev_t and the kernel concept of a dev_t are divergant. The only bit of user space allowed to know the number of major and minor bits is include/sys/sysmacros.h (i.e. part of libc). When used with a current C library and a 2.6.x kernel, this fix should allow BusyBox to support wide device major/minor numbers. -Erik
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/get_header_cpio.c3
-rw-r--r--archival/libunarchive/get_header_tar.c4
2 files changed, 4 insertions, 3 deletions
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c
index f72c37634..11925c4e3 100644
--- a/archival/libunarchive/get_header_cpio.c
+++ b/archival/libunarchive/get_header_cpio.c
@@ -18,6 +18,7 @@
18#include <stdlib.h> 18#include <stdlib.h>
19#include <string.h> 19#include <string.h>
20#include <unistd.h> 20#include <unistd.h>
21#include <sys/sysmacros.h> /* major() and minor() */
21#include "unarchive.h" 22#include "unarchive.h"
22#include "libbb.h" 23#include "libbb.h"
23 24
@@ -143,7 +144,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
143 } 144 }
144 } 145 }
145 } 146 }
146 file_header->device = (major << 8) | minor; 147 file_header->device = makedev(major, minor);
147 148
148 if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) { 149 if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
149 archive_handle->action_data(archive_handle); 150 archive_handle->action_data(archive_handle);
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 33f19c60a..1ad9ac5e5 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -121,8 +121,8 @@ extern char get_header_tar(archive_handle_t *archive_handle)
121 file_header->mtime = strtol(tar.formated.mtime, NULL, 8); 121 file_header->mtime = strtol(tar.formated.mtime, NULL, 8);
122 file_header->link_name = (tar.formated.linkname[0] != '\0') ? 122 file_header->link_name = (tar.formated.linkname[0] != '\0') ?
123 bb_xstrdup(tar.formated.linkname) : NULL; 123 bb_xstrdup(tar.formated.linkname) : NULL;
124 file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) + 124 file_header->device = makedev(strtol(tar.formated.devmajor, NULL, 8),
125 strtol(tar.formated.devminor, NULL, 8)); 125 strtol(tar.formated.devminor, NULL, 8));
126 126
127 /* Set bits 0-11 of the files mode */ 127 /* Set bits 0-11 of the files mode */
128 file_header->mode = 07777 & strtol(tar.formated.mode, NULL, 8); 128 file_header->mode = 07777 & strtol(tar.formated.mode, NULL, 8);