2009-06-25 Rafael Avila de Espindola <espindola@google.com>
authorDave Korn <dave.korn@artimi.com>
Thu, 25 Jun 2009 12:32:10 +0000 (12:32 +0000)
committerDave Korn <dave.korn@artimi.com>
Thu, 25 Jun 2009 12:32:10 +0000 (12:32 +0000)
* plugin.c (load_plugin): Use stat and S_ISREG instead of the d_type
field of struct dirent.

bfd/ChangeLog
bfd/plugin.c

index f5cbe7119e4f6aa20e67f1829b3505c240b0be22..0ac28206a7fdd7d980bfed0cf287e4ceead77e05 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-25  Rafael Avila de Espindola  <espindola@google.com>
+
+       * plugin.c (load_plugin): Use stat and S_ISREG instead of the d_type
+       field of struct dirent.
+
 2009-06-23  Tristan Gingold  <gingold@adacore.com>
 
        * vms.c (vms_get_synthetic_symtab): Remove duplicate definition
index ca47ab620f25af9b44eeb676bd7567c7df988c20..053fdd1bd70d00d5f862b3cea6b670033f1d1439 100644 (file)
@@ -203,11 +203,11 @@ load_plugin (void)
   while ((ent = readdir (d)))
     {
       char *full_name;
-      if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
-       continue;
+      struct stat s;
 
       full_name = concat (p, "/", ent->d_name, NULL);
-      found = try_load_plugin (full_name);
+      if (stat(full_name, &s) == 0 && S_ISREG (s.st_mode))
+       found = try_load_plugin (full_name);
       free (full_name);
       if (found)
        break;