aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2004-02-20 02:34:42 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2004-02-20 02:34:42 +0000
commit916ba53f1a31e22e40eb0f686dac50207f4b0b41 (patch)
treed789eadb929c130c30c7d02df1261280daddba56
parentc9f1fce9bb2cae41309dba87291cd0a1da5b6d2e (diff)
downloadbusybox-916ba53f1a31e22e40eb0f686dac50207f4b0b41.tar.gz
Fix up hard links
-rw-r--r--archival/libunarchive/get_header_tar.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 10b21c874..ad580617b 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -115,7 +115,6 @@ extern char get_header_tar(archive_handle_t *archive_handle)
file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name);
}
- file_header->mode = strtol(tar.formated.mode, NULL, 8);
file_header->uid = strtol(tar.formated.uid, NULL, 8);
file_header->gid = strtol(tar.formated.gid, NULL, 8);
file_header->size = strtol(tar.formated.size, NULL, 8);
@@ -125,11 +124,14 @@ extern char get_header_tar(archive_handle_t *archive_handle)
file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
strtol(tar.formated.devminor, NULL, 8));
- /* Fix mode, used by the old format */
+ /* Set bits 0-11 of the files mode */
+ file_header->mode = 07777 & strtol(tar.formated.mode, NULL, 8);
+
+ /* Set bits 12-15 of the files mode */
switch (tar.formated.typeflag) {
/* busybox identifies hard links as being regular files with 0 size and a link name */
case '1':
- file_header->mode &= (S_IFREG | 07777);
+ file_header->mode |= S_IFREG;
break;
case 'x':
case 'g':