All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] strip disk->name of partition suffix in grub_disk_open
@ 2010-07-09 17:23 Grégoire Sutre
  2010-07-20 13:52 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Grégoire Sutre @ 2010-07-09 17:23 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

Hi,

When the argument passed to grub_disk_open is a string containing a
partition, e.g. "hd0,msdos3,bsd7", disk->name is set to the full
string instead of just the prefix up to the first ',' (here "hd0").
This leads to incorrect partition identifiers when the disk name and
the partition name are concatenated (I observed this in the debug
messages of my nested partitions patch).

The attached patch fixes this issue.

Grégoire

[-- Attachment #2: grub_disk_open.diff --]
[-- Type: text/plain, Size: 499 bytes --]

=== modified file 'kern/disk.c'
--- kern/disk.c	2010-02-07 00:48:38 +0000
+++ kern/disk.c	2010-07-09 16:44:06 +0000
@@ -248,11 +248,16 @@ grub_disk_open (const char *name)
   if (! disk)
     return 0;
 
-  disk->name = grub_strdup (name);
+  p = find_part_sep (name);
+
+  if (p)
+    disk->name = grub_strndup (name, p - name);
+  else
+    disk->name = grub_strdup (name);
+
   if (! disk->name)
     goto fail;
 
-  p = find_part_sep (name);
   if (p)
     {
       grub_size_t len = p - name;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-21  0:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-09 17:23 [Patch] strip disk->name of partition suffix in grub_disk_open Grégoire Sutre
2010-07-20 13:52 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-07-21  0:12   ` Grégoire Sutre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.