Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jul 2009 18:11:44 +0000 (UTC)
From:      Tim Kientzle <kientzle@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r195895 - head/lib/libarchive
Message-ID:  <200907261811.n6QIBiFo076960@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kientzle
Date: Sun Jul 26 18:11:44 2009
New Revision: 195895
URL: http://svn.freebsd.org/changeset/base/195895

Log:
  The parser for Rockridge symlinks tended to insert
  extra slashes at the beginning of absolute targets.
  
  Thanks to Jung-uk Kim for pointing this out to me.
  
  Approved by:	re (kib)

Modified:
  head/lib/libarchive/archive_read_support_format_iso9660.c

Modified: head/lib/libarchive/archive_read_support_format_iso9660.c
==============================================================================
--- head/lib/libarchive/archive_read_support_format_iso9660.c	Sun Jul 26 15:06:59 2009	(r195894)
+++ head/lib/libarchive/archive_read_support_format_iso9660.c	Sun Jul 26 18:11:44 2009	(r195895)
@@ -1175,12 +1175,12 @@ static void
 parse_rockridge_SL1(struct file_info *file, const unsigned char *data,
     int data_length)
 {
-	int component_continues = 1;
+	const char *separator = "";
 
-	if (!file->symlink_continues)
+	if (!file->symlink_continues || file->symlink.length < 1)
 		archive_string_empty(&file->symlink);
-	else
-		archive_strcat(&file->symlink, "/");
+	else if (file->symlink.s[file->symlink.length - 1] != '/')
+		separator = "/";
 	file->symlink_continues = 0;
 
 	/*
@@ -1217,9 +1217,8 @@ parse_rockridge_SL1(struct file_info *fi
 		unsigned char nlen = *data++;
 		data_length -= 2;
 
-		if (!component_continues)
-			archive_strcat(&file->symlink, "/");
-		component_continues = 0;
+		archive_strcat(&file->symlink, separator);
+		separator = "/";
 
 		switch(flag) {
 		case 0: /* Usual case, this is text. */
@@ -1233,7 +1232,7 @@ parse_rockridge_SL1(struct file_info *fi
 				return;
 			archive_strncat(&file->symlink,
 			    (const char *)data, nlen);
-			component_continues = 1;
+			separator = "";
 			break;
 		case 0x02: /* Current dir. */
 			archive_strcat(&file->symlink, ".");
@@ -1244,6 +1243,7 @@ parse_rockridge_SL1(struct file_info *fi
 		case 0x08: /* Root of filesystem. */
 			archive_string_empty(&file->symlink);
 			archive_strcat(&file->symlink, "/");
+			separator = "";
 			break;
 		case 0x10: /* Undefined (historically "volume root" */
 			archive_string_empty(&file->symlink);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907261811.n6QIBiFo076960>