This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, fortran] Don't call stat before fopen
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Fortran List <fortran at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 1 Dec 2011 10:59:27 +0200
- Subject: [Patch, fortran] Don't call stat before fopen
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 <jb@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