* util/deviceiter.c (grub_util_iterate_devices): Save a bit of

effort by skipping "." and ".." entries up-front.
Suggested by: Michael Lazarev.
This commit is contained in:
Colin Watson 2010-11-24 19:43:32 +00:00
parent 5a4072785b
commit 74f72a6415
2 changed files with 10 additions and 0 deletions

View file

@ -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> 2010-11-24 Colin Watson <cjwatson@ubuntu.com>
* grub-core/Makefile.core.def (xz_decompress): Move -lgcc from * grub-core/Makefile.core.def (xz_decompress): Move -lgcc from

View file

@ -536,6 +536,10 @@ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
necessary. */ necessary. */
for (entry = readdir (dir); entry; entry = readdir (dir)) 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. */ /* Skip partition entries. */
if (strstr (entry->d_name, "-part")) if (strstr (entry->d_name, "-part"))
continue; continue;