summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/libunarchive/data_extract_all.c5
-rw-r--r--archival/libunarchive/get_header_tar.c5
2 files changed, 5 insertions, 5 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index bf3be5b..b77cd11 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)
}
}
- /* Handle hard links seperately */
- if (!S_ISLNK(file_header->mode) && (file_header->link_name) && (file_header->size == 0)) {
+ /* Handle hard links seperately
+ * We identified hard links as regular files of size 0 with a symlink */
+ if (S_ISREG(file_header->mode) && (file_header->link_name) && (file_header->size == 0)) {
/* hard link */
res = link(file_header->link_name, file_header->name);
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 603535a..561de1c 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)
file_header->mode |= S_IFIFO;
break;
# endif
- /* hard links are detected as entries with 0 size, a link name,
- * and not being a symlink, hence we have nothing to do here */
+ /* hard links are detected as regular files with 0 size and a link name */
case '1':
- file_header->mode |= ~S_IFLNK;
+ file_header->mode &= (S_IFREG | 07777);
break;
# ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
case 'L': {