From owner-svn-src-head@FreeBSD.ORG Sun Jul 26 18:11:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F522106566B; Sun, 26 Jul 2009 18:11:45 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D34B8FC14; Sun, 26 Jul 2009 18:11:45 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6QIBjIT076961; Sun, 26 Jul 2009 18:11:45 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6QIBiFo076960; Sun, 26 Jul 2009 18:11:44 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200907261811.n6QIBiFo076960@svn.freebsd.org> From: Tim Kientzle Date: Sun, 26 Jul 2009 18:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195895 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2009 18:11:45 -0000 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);