]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/deviceiter.c (grub_util_iterate_devices): Save a bit of
authorColin Watson <cjwatson@ubuntu.com>
Wed, 24 Nov 2010 19:43:32 +0000 (19:43 +0000)
committerColin Watson <cjwatson@ubuntu.com>
Wed, 24 Nov 2010 19:43:32 +0000 (19:43 +0000)
effort by skipping "." and ".." entries up-front.
Suggested by: Michael Lazarev.

ChangeLog
util/deviceiter.c

index f29ade31c57e9e1cbdcf904bacea5621b3df5e4c..6bc7f1b9e770dce8ebaa681bb2aa5ad128a639c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-24  Colin Watson  <cjwatson@ubuntu.com>
+
+       * util/deviceiter.c (grub_util_iterate_devices): Save a bit of
+       effort by skipping "." and ".." entries up-front.
+       Suggested by: Michael Lazarev.
+
 2010-11-24  Colin Watson  <cjwatson@ubuntu.com>
 
        * grub-core/Makefile.core.def (xz_decompress): Move -lgcc from
index 1de8e54df3391373a78fe30d272c7d827fdc5d2d..30c18beea3345d099048b4b8ee6d41828d0f0e6b 100644 (file)
@@ -536,6 +536,10 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
           necessary.  */
        for (entry = readdir (dir); entry; entry = readdir (dir))
          {
+           /* Skip current and parent directory entries.  */
+           if (strcmp (entry->d_name, ".") == 0 ||
+               strcmp (entry->d_name, "..") == 0)
+             continue;
            /* Skip partition entries.  */
            if (strstr (entry->d_name, "-part"))
              continue;