Skip to contentSkip to conversation

treat multiple slashes like one for JFS

PATCH In review Felix Zielcke 2 participants 3 messages Sep 25, 2008 – Sep 28, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 treat multiple slashes like one for JFS

Here's a patch to handle things like //boot/// for JFS which doestn't do it currently but Linux does it.

This was already brought up 2004 but I wonder why this isn't included
http://lists.gnu.org/archive/html/grub-devel/2004-08/msg00043.html

Probable this can be right now commited but as always I just want to be on the safe side.

2008-09-25 Felix Zielcke <[email protected]>

fs/jfs.c (grub_jfs_find_file): Treat multiple slashes like one.

jfs.c +7 -5
Index: fs/jfs.c
===================================================================
@@ -614,8 +614,8 @@ grub_jfs_find_file (struct grub_jfs_data
   if (grub_jfs_read_inode (data, GRUB_JFS_AGGR_INODE, &data->currinode))
     return grub_errno;
 
-  /* Skip the first slash.  */
-  if (name[0] == '/')
+  /* Skip the first slashes.  */
+  while (*name == '/')
     {
       name++;
       if (!*name)
@@ -626,10 +626,12 @@ grub_jfs_find_file (struct grub_jfs_data
   next = grub_strchr (name, '/');
   if (next)
     {
-      next[0] = '\0';
-      next++;
+      while (*next == '/')
+	{
+	  next[0] = '\0';
+	  next++;
+	}
     }
-  
   diro = grub_jfs_opendir (data, &data->currinode);
   if (!diro)
     return grub_errno;
#1 lore raw
Quoted 8 lines · Felix Zielcke

Here's a patch to handle things like //boot/// for JFS which doestn't do it currently but Linux does it.

This was already brought up 2004 but I wonder why this isn't included
http://lists.gnu.org/archive/html/grub-devel/2004-08/msg00043.html

Probable this can be right now commited but as always I just want to be on the safe side.

Assuming you tested it works, I don't see anything wrong in the code.

jfs.c grub_jfs_find_file (struct grub_jfs_data · line 633

Quoted 5 lines
jfs.c +5 -0
+      while (*next == '/')
+	{
+	  next[0] = '\0';
+	  next++;
+	}

This seems to incorporate a one-liner of code from Tomas Ebenlendr, I'd recommend to mention that in the changelog.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw

Am Sonntag, den 28.09.2008, 15:32 +0200 schrieb Robert Millan:

Quoted 11 lines · Felix Zielcke
Quoted 8 lines

Here's a patch to handle things like //boot/// for JFS which doestn't do it currently but Linux does it.

This was already brought up 2004 but I wonder why this isn't included
http://lists.gnu.org/archive/html/grub-devel/2004-08/msg00043.html

Probable this can be right now commited but as always I just want to be on the safe side.

Assuming you tested it works, I don't see anything wrong in the code.

Yep I tested it first :)

Quoted 8 lines

jfs.c grub_jfs_find_file (struct grub_jfs_data · line 633

Quoted 5 lines
jfs.c +5 -0
+      while (*next == '/')
+	{
+	  next[0] = '\0';
+	  next++;
+	}

This seems to incorporate a one-liner of code from Tomas Ebenlendr, I'd recommend to mention that in the changelog.

Ok commited with a hint that it's based on code from Tomas Ebenlendr.