summaryrefslogtreecommitdiffhomepage
path: root/archival/libunarchive
diff options
context:
space:
mode:
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 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/sysmacros.h> /* major() and minor() */
#include "unarchive.h"
#include "libbb.h"
@@ -143,7 +144,7 @@ extern char get_header_cpio(archive_handle_t *archive_handle)
}
}
}
- file_header->device = (major << 8) | minor;
+ file_header->device = makedev(major, minor);
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
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)
file_header->mtime = strtol(tar.formated.mtime, NULL, 8);
file_header->link_name = (tar.formated.linkname[0] != '\0') ?
bb_xstrdup(tar.formated.linkname) : NULL;
- file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
- strtol(tar.formated.devminor, NULL, 8));
+ file_header->device = makedev(strtol(tar.formated.devmajor, NULL, 8),
+ strtol(tar.formated.devminor, NULL, 8));
/* Set bits 0-11 of the files mode */
file_header->mode = 07777 & strtol(tar.formated.mode, NULL, 8);