-2013-10-10 Vladimir Serbinenko <phcoder@gmail.com>
+2013-10-11 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * util/grub-setup.c (setup): Move copying of partition table as
+ futher up as possible to avoid possible overwrite by floppy routines.
+
+2013-10-11 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/fat.c: Fix handling of exfat contiguous files.
grub_partition_iterate (dest_dev->disk, identify_partmap, &ctx);
+ /* Copy the partition table. */
+ if (ctx.dest_partmap ||
+ (!allow_floppy && !grub_util_biosdisk_is_floppy (dest_dev->disk)))
+ memcpy (boot_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
+ tmp_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
+ GRUB_BOOT_MACHINE_PART_END - GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC);
+
+ free (tmp_img);
+
if (ctx.container
&& grub_strcmp (ctx.container->partmap->name, "msdos") == 0
&& ctx.dest_partmap
}
- /* Copy the partition table. */
- if (ctx.dest_partmap ||
- (!allow_floppy && !grub_util_biosdisk_is_floppy (dest_dev->disk)))
- memcpy (boot_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
- tmp_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC,
- GRUB_BOOT_MACHINE_PART_END - GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC);
-
- free (tmp_img);
-
if (! ctx.dest_partmap && ! fs && !is_ldm)
{
grub_util_warn ("%s", _("Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea."));