]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-08-23 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Sat, 23 Aug 2008 12:19:43 +0000 (12:19 +0000)
committerrobertmh <robertmh@localhost>
Sat, 23 Aug 2008 12:19:43 +0000 (12:19 +0000)
        * util/getroot.c (find_root_device): Skip anything that starts with
        a dot, not just directories.  This avoids things like /dev/.tmp.md0.

ChangeLog
util/getroot.c

index 4ea1fa416ebfb777786cf63a21701346105ab267..3b0ce520b580c5640627a98bdcd436a191d34e2b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-23  Robert Millan  <rmh@aybabtu.com>
+
+       * util/getroot.c (find_root_device): Skip anything that starts with
+       a dot, not just directories.  This avoids things like /dev/.tmp.md0.
+
 2008-08-22  Felix Zielcke  <fzielcke@z-51.de>
          
        * util/update-grub.in (GRUB_GFXMODE): Export variable.
index c8d31ede29109fbbea9c5115d836fa752fd738cd..826092b99995df868297a0057f2ad1499c943d33 100644 (file)
@@ -196,7 +196,10 @@ find_root_device (const char *dir, dev_t dev)
     {
       struct stat st;
       
-      if (strcmp (ent->d_name, ".") == 0 || strcmp (ent->d_name, "..") == 0)
+      /* Avoid:
+        - dotfiles (like "/dev/.tmp.md0") since they could be duplicates.
+        - dotdirs (like "/dev/.static") since they could contain duplicates.  */
+      if (ent->d_name[0] == '.')
        continue;
 
       if (lstat (ent->d_name, &st) < 0)
@@ -207,11 +210,9 @@ find_root_device (const char *dir, dev_t dev)
        /* Don't follow symbolic links.  */
        continue;
       
-      if (S_ISDIR (st.st_mode) && ent->d_name[0] != '.')
+      if (S_ISDIR (st.st_mode))
        {
-         /* Find it recursively, but avoid dotdirs (like ".static") since they
-            could contain duplicates, which would later break the
-            pathname-based check */
+         /* Find it recursively.  */
          char *res;
 
          res = find_root_device (ent->d_name, dev);