summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-17 05:48:10 +0000
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-17 05:48:10 +0000
commite213d8e025daa41f37af5adb810063be700c4f94 (patch)
tree2dfa4f7e5bab4c7c2953b9e4aa9c0005366a126f /libgfortran
parent12f380bc6e1b9a07605d44abd1ba7b8e0abbaf2e (diff)
downloadgcc-e213d8e025daa41f37af5adb810063be700c4f94.tar.gz
PR47296 Segfault when running out of file descriptors
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168888 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/unix.c12
2 files changed, 10 insertions, 8 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 1eeeda3b528..cab2d1501e0 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-17 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/47296
+ * io/unix.c (tempfile): Set opp->file and opp->file_len also if an
+ error occurs.
+
2011-01-16 Jakub Jelinek <jakub@redhat.com>
PR fortran/46625
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index e66560f5839..fa64e20b026 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+ 2011
Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
@@ -1084,13 +1085,8 @@ tempfile (st_parameter_open *opp)
while (fd == -1 && errno == EEXIST);
#endif /* HAVE_MKSTEMP */
- if (fd < 0)
- free (template);
- else
- {
- opp->file = template;
- opp->file_len = strlen (template); /* Don't include trailing nul */
- }
+ opp->file = template;
+ opp->file_len = strlen (template); /* Don't include trailing nul */
return fd;
}