From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OXHIq-0003hO-Vh for mharc-grub-devel@gnu.org; Fri, 09 Jul 2010 13:23:57 -0400 Received: from [140.186.70.92] (port=34392 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXHIn-0003gC-Ko for grub-devel@gnu.org; Fri, 09 Jul 2010 13:23:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXHIm-00075l-LB for grub-devel@gnu.org; Fri, 09 Jul 2010 13:23:53 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:33925) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXHIm-00075S-Bt for grub-devel@gnu.org; Fri, 09 Jul 2010 13:23:52 -0400 Received: by wwe15 with SMTP id 15so1031931wwe.0 for ; Fri, 09 Jul 2010 10:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=Ryz7tjrBZJG6IK8vsW6GfLLNDqt43LhzuN9leyo/jJU=; b=vT/RK34hobYj+03vUTYfENQ2PPqdfkjH8+0xzeNVVagbNAL5y6Wx0i43wTfROwRYx2 h9+cbqk4/W5P4MigSY6ytu0RE8Lpq9qKm/OtnY1j7GCxYJv2hdZYRxS01PyYppcQFxHF wagOj2rNU79J3U373RLB8mCmn/HRA71vM7Hro= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=qNUuze/LxP/RXFepn7nbI5b8cy9N+q3Wtcpf4tz6Bj/k+BP1zdP2q/ofiaKIBdAIbS rdQqzg2VPr/NH92X1utwdQAUGcU5xyogao+pVdyPB+Cpo/s37EruQ/iFnogjQ4TdKpB2 hyC5Oi6qm04a9y0QfArL4gKD7k/NF6GWTa7l8= Received: by 10.227.128.210 with SMTP id l18mr8650961wbs.59.1278696231317; Fri, 09 Jul 2010 10:23:51 -0700 (PDT) Received: from [147.210.129.4] (laptop-147-210-129-4.labri.fr [147.210.129.4]) by mx.google.com with ESMTPS id u7sm146417weq.32.2010.07.09.10.23.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 09 Jul 2010 10:23:50 -0700 (PDT) Message-ID: <4C375B25.7060306@gmail.com> Date: Fri, 09 Jul 2010 19:23:49 +0200 From: =?ISO-8859-1?Q?Gr=E9goire_Sutre?= User-Agent: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.9.1.9) Gecko/20100603 Shredder/3.0.4 MIME-Version: 1.0 To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="------------080300070405000102050403" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Patch] strip disk->name of partition suffix in grub_disk_open X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2010 17:23:54 -0000 This is a multi-part message in MIME format. --------------080300070405000102050403 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi, When the argument passed to grub_disk_open is a string containing a partition, e.g. "hd0,msdos3,bsd7", disk->name is set to the full string instead of just the prefix up to the first ',' (here "hd0"). This leads to incorrect partition identifiers when the disk name and the partition name are concatenated (I observed this in the debug messages of my nested partitions patch). The attached patch fixes this issue. Grégoire --------------080300070405000102050403 Content-Type: text/plain; name="grub_disk_open.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grub_disk_open.diff" === modified file 'kern/disk.c' --- kern/disk.c 2010-02-07 00:48:38 +0000 +++ kern/disk.c 2010-07-09 16:44:06 +0000 @@ -248,11 +248,16 @@ grub_disk_open (const char *name) if (! disk) return 0; - disk->name = grub_strdup (name); + p = find_part_sep (name); + + if (p) + disk->name = grub_strndup (name, p - name); + else + disk->name = grub_strdup (name); + if (! disk->name) goto fail; - p = find_part_sep (name); if (p) { grub_size_t len = p - name; --------------080300070405000102050403--