[BusyBox-cvs] busybox/archival/libunarchive get_header_tar.c, 1.20, 1.21

Glenn McGrath bug1 at busybox.net
Tue Sep 9 17:41:07 UTC 2003


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

Modified Files:
	get_header_tar.c 
Log Message:
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.



Index: get_header_tar.c
===================================================================
RCS file: /var/cvs/busybox/archival/libunarchive/get_header_tar.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- get_header_tar.c	14 Aug 2003 02:55:15 -0000	1.20
+++ get_header_tar.c	9 Sep 2003 17:41:03 -0000	1.21
@@ -105,10 +105,6 @@
 	} else {
 		file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name);
 	}
-	tmp = last_char_is(archive_handle->file_header->name, '/');
-	if (tmp) {
-		*tmp = '\0';
-	}
 
 	file_header->mode = strtol(tar.formated.mode, NULL, 8);
 	file_header->uid = strtol(tar.formated.uid, NULL, 8);
@@ -126,7 +122,11 @@
 # ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
 	case 0:
 	case '0':
-		file_header->mode |= S_IFREG;
+		if (last_char_is(file_header->name, '/')) {
+			file_header->mode |= S_IFDIR;
+		} else {
+			file_header->mode |= S_IFREG;
+		}
 		break;
 #if 0
 	/* hard links are detected as entries with 0 size, a link name, 




More information about the busybox-cvs mailing list