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.
This commit is contained in:
okuji 2006-10-14 21:07:48 +00:00
parent 4dc2cf6c2f
commit e0994b8b1c
3 changed files with 24 additions and 9 deletions

View file

@ -1,3 +1,14 @@
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> 2006-10-14 Robert Millan <rmh@aybabtu.com>
* util/i386/pc/getroot.c (grub_guess_root_device): Stop using * util/i386/pc/getroot.c (grub_guess_root_device): Stop using

View file

@ -592,7 +592,7 @@ make_device_name (int drive, int dos_part, int bsd_part)
sprintf (p, (drive & 0x80) ? "hd%d" : "fd%d", drive & ~0x80); sprintf (p, (drive & 0x80) ? "hd%d" : "fd%d", drive & ~0x80);
if (dos_part >= 0) if (dos_part >= 0)
sprintf (p + strlen (p), ",%d", dos_part); sprintf (p + strlen (p), ",%d", dos_part + 1);
if (bsd_part >= 0) if (bsd_part >= 0)
sprintf (p + strlen (p), ",%c", bsd_part + 'a'); sprintf (p + strlen (p), ",%c", bsd_part + 'a');

View file

@ -80,7 +80,7 @@ static void
probe (const char *path) probe (const char *path)
{ {
char *device_name; char *device_name;
char *drive_name; char *drive_name = 0;
grub_device_t dev; grub_device_t dev;
grub_fs_t fs; grub_fs_t fs;
@ -88,30 +88,30 @@ probe (const char *path)
if (! device_name) if (! device_name)
{ {
fprintf (stderr, "cannot find a device for %s.\n", path); fprintf (stderr, "cannot find a device for %s.\n", path);
return; goto end;
} }
if (print == PRINT_DEVICE) if (print == PRINT_DEVICE)
{ {
printf ("%s\n", device_name); printf ("%s\n", device_name);
return; goto end;
} }
drive_name = grub_util_biosdisk_get_grub_dev (device_name); drive_name = grub_util_biosdisk_get_grub_dev (device_name);
if (! drive_name) if (! drive_name)
{ {
fprintf (stderr, "cannot find a GRUB drive for %s.\n", drive_name); fprintf (stderr, "cannot find a GRUB drive for %s.\n", device_name);
return; goto end;
} }
if (print == PRINT_DRIVE) if (print == PRINT_DRIVE)
{ {
printf ("(%s)\n", drive_name); printf ("(%s)\n", drive_name);
return; goto end;
} }
grub_util_info ("opening %s", device_name); grub_util_info ("opening %s", drive_name);
dev = grub_device_open (device_name); dev = grub_device_open (drive_name);
if (! dev) if (! dev)
grub_util_error ("%s", grub_errmsg); grub_util_error ("%s", grub_errmsg);
@ -122,7 +122,11 @@ probe (const char *path)
printf ("%s\n", fs->name); printf ("%s\n", fs->name);
grub_device_close (dev); grub_device_close (dev);
end:
free (device_name); free (device_name);
free (drive_name);
} }
static struct option options[] = static struct option options[] =