diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-11-27 00:01:43 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-11-27 00:01:43 +0000 |
commit | e39ee01821d537b3b249b0c136bb150734016c35 (patch) | |
tree | f80ff1767e2b0fc8ce022bf45e36ffc776e9e8f9 /archival | |
parent | fea4b446df1b4d7c81804252ec7978092143f36e (diff) | |
download | busybox-w32-e39ee01821d537b3b249b0c136bb150734016c35.tar.gz busybox-w32-e39ee01821d537b3b249b0c136bb150734016c35.tar.bz2 busybox-w32-e39ee01821d537b3b249b0c136bb150734016c35.zip |
Fix tar hard links
Diffstat (limited to 'archival')
-rw-r--r-- | archival/libunarchive/data_extract_all.c | 5 | ||||
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 5 |
2 files changed, 5 insertions, 5 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c index bf3be5b35..b77cd11ae 100644 --- a/archival/libunarchive/data_extract_all.c +++ b/archival/libunarchive/data_extract_all.c | |||
@@ -66,8 +66,9 @@ extern void data_extract_all(archive_handle_t *archive_handle) | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | /* Handle hard links seperately */ | 69 | /* Handle hard links seperately |
70 | if (!S_ISLNK(file_header->mode) && (file_header->link_name) && (file_header->size == 0)) { | 70 | * We identified hard links as regular files of size 0 with a symlink */ |
71 | if (S_ISREG(file_header->mode) && (file_header->link_name) && (file_header->size == 0)) { | ||
71 | /* hard link */ | 72 | /* hard link */ |
72 | res = link(file_header->link_name, file_header->name); | 73 | res = link(file_header->link_name, file_header->name); |
73 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { | 74 | if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) { |
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 603535a4c..561de1c03 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c | |||
@@ -151,10 +151,9 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
151 | file_header->mode |= S_IFIFO; | 151 | file_header->mode |= S_IFIFO; |
152 | break; | 152 | break; |
153 | # endif | 153 | # endif |
154 | /* hard links are detected as entries with 0 size, a link name, | 154 | /* hard links are detected as regular files with 0 size and a link name */ |
155 | * and not being a symlink, hence we have nothing to do here */ | ||
156 | case '1': | 155 | case '1': |
157 | file_header->mode |= ~S_IFLNK; | 156 | file_header->mode &= (S_IFREG | 07777); |
158 | break; | 157 | break; |
159 | # ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS | 158 | # ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS |
160 | case 'L': { | 159 | case 'L': { |