* util/grub-setup.c (setup): Move copying of partition table as
futher up as possible to avoid possible overwrite by floppy routines.
This commit is contained in:
parent
60d4f0bb45
commit
ba9baabecd
2 changed files with 15 additions and 10 deletions
|
@ -1,4 +1,9 @@
|
||||||
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-core/fs/fat.c: Fix handling of exfat contiguous files.
|
||||||
|
|
||||||
|
|
|
@ -396,6 +396,15 @@ setup (const char *dir,
|
||||||
|
|
||||||
grub_partition_iterate (dest_dev->disk, identify_partmap, &ctx);
|
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
|
if (ctx.container
|
||||||
&& grub_strcmp (ctx.container->partmap->name, "msdos") == 0
|
&& grub_strcmp (ctx.container->partmap->name, "msdos") == 0
|
||||||
&& ctx.dest_partmap
|
&& ctx.dest_partmap
|
||||||
|
@ -450,15 +459,6 @@ setup (const char *dir,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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)
|
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."));
|
grub_util_warn ("%s", _("Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea."));
|
||||||
|
|
Loading…
Reference in a new issue