From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1DneRY-00017x-4z for mharc-grub-devel@gnu.org; Wed, 29 Jun 2005 11:25:40 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DneRV-000163-DJ for grub-devel@gnu.org; Wed, 29 Jun 2005 11:25:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DneRP-00013D-4B for grub-devel@gnu.org; Wed, 29 Jun 2005 11:25:31 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DneRP-00012p-1P for grub-devel@gnu.org; Wed, 29 Jun 2005 11:25:31 -0400 Received: from [217.12.11.35] (helo=smtp004.mail.ukl.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.34) id 1DneRr-00021s-NB for grub-devel@gnu.org; Wed, 29 Jun 2005 11:25:59 -0400 Received: (qmail 72635 invoked from network); 29 Jun 2005 15:21:09 -0000 Received: from unknown (HELO ?192.168.0.2?) (subdino2004@83.194.164.58 with plain) by smtp004.mail.ukl.yahoo.com with SMTP; 29 Jun 2005 15:21:08 -0000 Message-ID: <42C2BC69.8080102@yahoo.fr> Date: Wed, 29 Jun 2005 17:21:13 +0200 From: Vincent Pelletier User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: The development of GRUB 2 References: <20050629083358.250134cc@localhost> In-Reply-To: <20050629083358.250134cc@localhost> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/mixed; boundary="------------070801040903090006000204" Subject: Re: [Bulk] grub2: commands/cmp.c: grub_cmd_cmp() X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2005 15:25:38 -0000 This is a multi-part message in MIME format. --------------070801040903090006000204 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Rodrigo Steinmüller Wanderley wrote: > When reading the cmp commands I found some points I > couldn't understand, think they are bugs, but maybe some of you guys can > prove me wrong... You are right :). Thanks for your bug report. Please tell me if this patch is ok for you. nb: I haven't tested these changes beyond "make", but I think they are trivial enough to be trusted... 2005-06-29 Vincent Pelletier * commands/cmp.c (grub_cmd_cmp): Close the right file at the right time. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCwrxoFEQoKRQyjtURAkebAJ0d0+or1iWfjjGvDJUWeQTzPXm8JQCgmvum QFQJwUA+/ff5iNdG1DaKZ+w= =4HC3 -----END PGP SIGNATURE----- --------------070801040903090006000204 Content-Type: text/plain; name="cmp.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cmp.c.diff" Index: cmp.c =================================================================== RCS file: /cvsroot/grub/grub2/commands/cmp.c,v retrieving revision 1.2 diff -u -p -r1.2 cmp.c --- cmp.c 4 Apr 2004 13:46:00 -0000 1.2 +++ cmp.c 29 Jun 2005 15:14:59 -0000 @@ -44,7 +44,7 @@ grub_cmd_cmp (struct grub_arg_list *stat file2 = grub_file_open (args[1]); if (! file2) { - grub_file_close (file2); + grub_file_close (file1); return grub_errno; } @@ -67,7 +67,7 @@ grub_cmd_cmp (struct grub_arg_list *stat rd2 = grub_file_read (file2, buf2, 512); if (rd1 != rd2) - return 0; + goto cleanup; for (i = 0; i < 512; i++) { @@ -76,10 +76,7 @@ grub_cmd_cmp (struct grub_arg_list *stat grub_printf ("Differ at the offset %d: 0x%x [%s], 0x%x [%s]\n", i + pos, buf1[i], args[0], buf2[i], args[1]); - - grub_file_close (file1); - grub_file_close (file2); - return 0; + goto cleanup; } } pos += 512; @@ -87,11 +84,12 @@ grub_cmd_cmp (struct grub_arg_list *stat } while (rd2); } + grub_printf ("The files are identical.\n"); + +cleanup: grub_file_close (file1); grub_file_close (file2); - grub_printf ("The files are identical.\n"); - return 0; } --------------070801040903090006000204-- ___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com