]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/jfs.c (grub_jfs_find_file): Handle "." and "..".
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 26 May 2012 23:03:26 +0000 (01:03 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 26 May 2012 23:03:26 +0000 (01:03 +0200)
ChangeLog
grub-core/fs/jfs.c

index c26473f44e13ea3f735e2b98d39f02d614625e48..7f1ddea4309e2bc2464a604ce7245696153e1796 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-27  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/jfs.c (grub_jfs_find_file): Handle "." and "..".
+
 2012-05-27  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/fs/ntfs.c (list_file): Set mtime to correct value.
index 496e489998ca7c5f467dcb82c1c8fea3af9a44cd..b98a5a374934d6f7d13b0e3898fc3bb38787b3c7 100644 (file)
@@ -672,9 +672,53 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path,
 
   for (;;)
     {
-      if (grub_strlen (name) == 0)
+      if (name[0] == 0)
        return GRUB_ERR_NONE;
 
+      if (name[0] == '.' && name[1] == 0)
+       {
+         if (!next)
+           return 0;
+
+         name = next;
+         next = grub_strchr (name, '/');
+         while (next && *next == '/')
+           {
+             next[0] = '\0';
+             next++;
+           }
+         continue;
+       }
+
+      if (name[0] == '.' && name[1] == '.' && name[2] == 0)
+       {
+         grub_uint32_t ino = grub_le_to_cpu32 (data->currinode.dir.header.idotdot);
+
+         grub_jfs_closedir (diro);
+         diro = 0;
+
+         if (grub_jfs_read_inode (data, ino, &data->currinode))
+           break;
+
+         if (!next)
+           return 0;
+
+         name = next;
+         next = grub_strchr (name, '/');
+         while (next && *next == '/')
+           {
+             next[0] = '\0';
+             next++;
+           }
+
+         /* Open this directory for reading dirents.  */
+         diro = grub_jfs_opendir (data, &data->currinode);
+         if (!diro)
+           return grub_errno;
+
+         continue;
+       }
+
       if (grub_jfs_getent (diro) == GRUB_ERR_OUT_OF_RANGE)
        break;