[2336] 2009-06-17 Vladimir Serbinenko <[email protected]>

Vladimir Serbinenko <[email protected]> Wed, 17 Jun 2009 13:15:34 +0000
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2336
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2336
Author:   phcoder
Date:     2009-06-17 13:15:33 +0000 (Wed, 17 Jun 2009)
Log Message:
-----------
2009-06-17  Vladimir Serbinenko  <[email protected]>

	avoid double grub_adjust_range call. Bug reported by David Simner

	* kern/disk.c (grub_disk_write): change to raw disk access before
	calling disk_read

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/kern/disk.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-06-17 06:07:36 UTC (rev 2335)
+++ trunk/grub2/ChangeLog	2009-06-17 13:15:33 UTC (rev 2336)
@@ -1,3 +1,10 @@
+2009-06-17  Vladimir Serbinenko  <[email protected]>
+
+	avoid double grub_adjust_range call. Bug reported by David Simner
+
+	* kern/disk.c (grub_disk_write): change to raw disk access before
+	calling disk_read
+
 2009-06-17  Colin Watson  <[email protected]>
 
 	* util/elf/grub-mkimage.c (usage): Prefix each option line with two

Modified: trunk/grub2/kern/disk.c
===================================================================
--- trunk/grub2/kern/disk.c	2009-06-17 06:07:36 UTC (rev 2335)
+++ trunk/grub2/kern/disk.c	2009-06-17 13:15:33 UTC (rev 2336)
@@ -542,10 +542,17 @@
 	{
 	  char tmp_buf[GRUB_DISK_SECTOR_SIZE];
 	  grub_size_t len;
+	  grub_partition_t part;
 
+	  part = disk->partition;
+	  disk->partition = 0;
 	  if (grub_disk_read (disk, sector, 0, GRUB_DISK_SECTOR_SIZE, tmp_buf)
 	      != GRUB_ERR_NONE)
-	    goto finish;
+	    {
+	      disk->partition = part;
+	      goto finish;
+	    }
+	  disk->partition = part;
 
 	  len = GRUB_DISK_SECTOR_SIZE - real_offset;
 	  if (len > size)