registry: do quick check for . files
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 21 Oct 2009 01:01:55 +0000 (21:01 -0400)
committerWim Taymans <wim@metal.(none)>
Wed, 21 Oct 2009 01:15:56 +0000 (21:15 -0400)
Do a quick check for . files before calling the strcmp functions

gst/gstregistry.c

index 58b5c55..815a30a 100644 (file)
@@ -950,8 +950,10 @@ gst_registry_scan_path_level (GstRegistryScanContext * context,
 
     if (file_status.st_mode & S_IFDIR) {
       /* skip the .debug directory, these contain elf files that are not
-       * useful or worse, can crash dlopen () */
-      if (g_str_equal (dirent, ".debug") || g_str_equal (dirent, ".git")) {
+       * useful or worse, can crash dlopen (). do a quick check for the . first
+       * and then call the compare functions. */
+      if (G_UNLIKELY (dirent[0] == '.' && (g_str_equal (dirent, ".debug")
+                  || g_str_equal (dirent, ".git")))) {
         GST_LOG_OBJECT (context->registry, "ignoring .debug or .git directory");
         g_free (filename);
         continue;