Hi,

there's no need to stat() the filename before we fopen() it in
gfc_open_file(). If the file doesn't exist, fopen() will return NULL
anyway, and if the user really wants to read source or module data
from a special file, so be it.

Committed to trunk as obvious.

2011-12-01  Janne Blomqvist  <j...@gcc.gnu.org>

        * misc.c (gfc_open_file): Don't call stat.


Index: misc.c
===================================================================
--- misc.c      (revision 181874)
+++ misc.c      (working copy)
@@ -58,17 +58,9 @@ gfc_clear_ts (gfc_typespec *ts)
 FILE *
 gfc_open_file (const char *name)
 {
-  struct stat statbuf;
-
   if (!*name)
     return stdin;

-  if (stat (name, &statbuf) < 0)
-    return NULL;
-
-  if (!S_ISREG (statbuf.st_mode))
-    return NULL;
-
   return fopen (name, "r");
 }


-- 
Janne Blomqvist

Reply via email to