+2006-10-14 Yoshinori K. Okuji <okuji@enbug.org>
+
+ * util/i386/pc/grub-probe.c (probe): Print DEVICE_NAME instead of
+ DRIVE_NAME when grub_util_biosdisk_get_grub_dev fails. Open
+ DRIVE_NAME instead of DEVICE_NAME. Make sure that DEVICE_NAME and
+ DRIVE_NAME are always freed.
+
+ * util/i386/pc/biosdisk.c (make_device_name): Add one into
+ DOS_PART, as a DOS partition is counted from one instead of zero
+ now. Reported by Robert Millan.
+
2006-10-14 Robert Millan <rmh@aybabtu.com>
* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
sprintf (p, (drive & 0x80) ? "hd%d" : "fd%d", drive & ~0x80);
if (dos_part >= 0)
- sprintf (p + strlen (p), ",%d", dos_part);
+ sprintf (p + strlen (p), ",%d", dos_part + 1);
if (bsd_part >= 0)
sprintf (p + strlen (p), ",%c", bsd_part + 'a');
probe (const char *path)
{
char *device_name;
- char *drive_name;
+ char *drive_name = 0;
grub_device_t dev;
grub_fs_t fs;
if (! device_name)
{
fprintf (stderr, "cannot find a device for %s.\n", path);
- return;
+ goto end;
}
if (print == PRINT_DEVICE)
{
printf ("%s\n", device_name);
- return;
+ goto end;
}
drive_name = grub_util_biosdisk_get_grub_dev (device_name);
if (! drive_name)
{
- fprintf (stderr, "cannot find a GRUB drive for %s.\n", drive_name);
- return;
+ fprintf (stderr, "cannot find a GRUB drive for %s.\n", device_name);
+ goto end;
}
if (print == PRINT_DRIVE)
{
printf ("(%s)\n", drive_name);
- return;
+ goto end;
}
- grub_util_info ("opening %s", device_name);
- dev = grub_device_open (device_name);
+ grub_util_info ("opening %s", drive_name);
+ dev = grub_device_open (drive_name);
if (! dev)
grub_util_error ("%s", grub_errmsg);
printf ("%s\n", fs->name);
grub_device_close (dev);
+
+ end:
+
free (device_name);
+ free (drive_name);
}
static struct option options[] =