[BusyBox-cvs] busybox/archival/libunarchive get_header_tar.c, 1.29, 1.30 data_extract_all.c, 1.16, 1.17

Glenn McGrath bug1 at busybox.net
Thu Nov 27 00:01:48 UTC 2003


Update of /var/cvs/busybox/archival/libunarchive
In directory winder:/tmp/cvs-serv18372/archival/libunarchive

Modified Files:
	get_header_tar.c data_extract_all.c 
Log Message:
Fix tar hard links


Index: data_extract_all.c
===================================================================
RCS file: /var/cvs/busybox/archival/libunarchive/data_extract_all.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- data_extract_all.c	21 Nov 2003 22:24:48 -0000	1.16
+++ data_extract_all.c	27 Nov 2003 00:01:43 -0000	1.17
@@ -66,8 +66,9 @@
 		}
 	}
 
-	/* 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)) {

Index: get_header_tar.c
===================================================================
RCS file: /var/cvs/busybox/archival/libunarchive/get_header_tar.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- get_header_tar.c	21 Nov 2003 22:24:48 -0000	1.29
+++ get_header_tar.c	27 Nov 2003 00:01:43 -0000	1.30
@@ -151,10 +151,9 @@
 		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': {




More information about the busybox-cvs mailing list