summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-09-09 17:41:03 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-09-09 17:41:03 +0000
commit87af49f26b2293ab60d0f13d2a14cad66e02a6ff (patch)
tree0437f8520562dbadcb88df39f10bd14198347f87 /archival
parent640fb86b283d208a26d65c1b25aedbf37a6aca46 (diff)
downloadbusybox-w32-87af49f26b2293ab60d0f13d2a14cad66e02a6ff.tar.gz
busybox-w32-87af49f26b2293ab60d0f13d2a14cad66e02a6ff.tar.bz2
busybox-w32-87af49f26b2293ab60d0f13d2a14cad66e02a6ff.zip
If a tar entry is a regualr file ending in a '/' then its really a
directory. From http://www.gnu.org/manual/tar/html_node/tar_123.html REGTYPE AREGTYPE These flags represent a regular file. In order to be compatible with older versions of tar, a typeflag value of AREGTYPE should be silently recognized as a regular file. New archives should be created using REGTYPE. Also, for backward compatibility, tar treats a regular file whose name ends with a slash as a directory.
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/get_header_tar.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 3bbe15d36..55c9a22f4 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -105,10 +105,6 @@ extern char get_header_tar(archive_handle_t *archive_handle)
105 } else { 105 } else {
106 file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name); 106 file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name);
107 } 107 }
108 tmp = last_char_is(archive_handle->file_header->name, '/');
109 if (tmp) {
110 *tmp = '\0';
111 }
112 108
113 file_header->mode = strtol(tar.formated.mode, NULL, 8); 109 file_header->mode = strtol(tar.formated.mode, NULL, 8);
114 file_header->uid = strtol(tar.formated.uid, NULL, 8); 110 file_header->uid = strtol(tar.formated.uid, NULL, 8);
@@ -126,7 +122,11 @@ extern char get_header_tar(archive_handle_t *archive_handle)
126# ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY 122# ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
127 case 0: 123 case 0:
128 case '0': 124 case '0':
129 file_header->mode |= S_IFREG; 125 if (last_char_is(file_header->name, '/')) {
126 file_header->mode |= S_IFDIR;
127 } else {
128 file_header->mode |= S_IFREG;
129 }
130 break; 130 break;
131#if 0 131#if 0
132 /* hard links are detected as entries with 0 size, a link name, 132 /* hard links are detected as entries with 0 size, a link name,