]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2006-10-14 Yoshinori K. Okuji <okuji@enbug.org>
authorokuji <okuji@localhost>
Sat, 14 Oct 2006 21:07:48 +0000 (21:07 +0000)
committerokuji <okuji@localhost>
Sat, 14 Oct 2006 21:07:48 +0000 (21:07 +0000)
        * 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.

ChangeLog
util/i386/pc/biosdisk.c
util/i386/pc/grub-probe.c

index 08d56cdef5b4d0414ed07b5bc2bd843eb7ea55b3..d63f1696bafea6e7e078bc3c923a295564234e8e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * util/i386/pc/getroot.c (grub_guess_root_device): Stop using
index 2459999ec50ec0282075e871e3846d58840f2496..4d8131c8e0b703c90dcf5e7003beacad6be1eecf 100644 (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);
   
   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');
index 2568ba468198938af938c9b906891e074fd6de49..7f71dafe9397cb9289f3b5c56b21e66daf8638dd 100644 (file)
@@ -80,7 +80,7 @@ static void
 probe (const char *path)
 {
   char *device_name;
-  char *drive_name;
+  char *drive_name = 0;
   grub_device_t dev;
   grub_fs_t fs;
   
@@ -88,30 +88,30 @@ probe (const char *path)
   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);
 
@@ -122,7 +122,11 @@ probe (const char *path)
   printf ("%s\n", fs->name);
   
   grub_device_close (dev);
+
+ end:
+  
   free (device_name);
+  free (drive_name);
 }
 
 static struct option options[] =