[BusyBox-cvs] busybox/archival/libunarchive get_header_tar.c, 1.34, 1.35

Glenn McGrath bug1 at busybox.net
Fri Feb 20 02:34:45 UTC 2004


Update of /var/cvs/busybox/archival/libunarchive
In directory nail:/tmp/cvs-serv4392/archival/libunarchive

Modified Files:
	get_header_tar.c 
Log Message:
Fix up hard links


Index: get_header_tar.c
===================================================================
RCS file: /var/cvs/busybox/archival/libunarchive/get_header_tar.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- get_header_tar.c	20 Feb 2004 02:25:18 -0000	1.34
+++ get_header_tar.c	20 Feb 2004 02:34:42 -0000	1.35
@@ -115,7 +115,6 @@
 		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 @@
 	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':




More information about the busybox-cvs mailing list