This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47296] I/O Segfault when running out of file descriptors
- From: "jb at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 15 Jan 2011 09:18:43 +0000
- Subject: [Bug fortran/47296] I/O Segfault when running out of file descriptors
- Auto-submitted: auto-generated
- References: <bug-47296-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47296
Janne Blomqvist <jb at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jb at gcc dot gnu.org
--- Comment #5 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-01-15 09:18:18 UTC ---
Nice catch.
Looking at the code, when creating a SCRATCH file fails, unix.c:tempfile()
returns -1, then as a result open_external() returns NULL, but then in
open.c:new_unit() even though we have checked that open_external() returns
NULL, we still call unpack_filename(), as well as accessing opp->file_len.
Just to be sure, I suspect it would be prudent to set opp->file to NULL and
opp->file_len to 0 in tempfile() in case fd < 0. Or are we sure that the entire
opp struct is set to 0 sometime before?