From 9cd72574bcdf3fb8ec5bf203a4968aae8c321eae Mon Sep 17 00:00:00 2001 From: Janne Blomqvist Date: Mon, 17 Jan 2011 07:48:10 +0200 Subject: PR47296 Segfault when running out of file descriptors From-SVN: r168888 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/io/unix.c | 12 ++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'libgfortran') diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1eeeda3..cab2d15 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2011-01-17 Janne Blomqvist + + PR libfortran/47296 + * io/unix.c (tempfile): Set opp->file and opp->file_len also if an + error occurs. + 2011-01-16 Jakub Jelinek PR fortran/46625 diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index e66560f..fa64e20 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; } -- cgit v1.1