This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] PR 20179


Since people seem to work on gfortran on week-ends (just like I sometimes do), I'd like to ping this very simple patch.

Attached patch fixes PR 20179, about mixing C and Fortran I/O. In
short: we don't want to close() stdout and stderr file descriptors
when the library exits.

Regtesting on its way on i386-linux. OK for mainline and 4.0?

Now, regtesting is finished, and there's no regression.


FX
Index: libgfortran/io/unix.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/io/unix.c,v
retrieving revision 1.26
diff -p -u -r1.26 unix.c
--- libgfortran/io/unix.c       17 May 2005 16:54:51 -0000      1.26
+++ libgfortran/io/unix.c       23 May 2005 17:06:48 -0000
@@ -542,8 +542,11 @@ fd_close (unix_stream * s)
   if (s->buffer != NULL && s->buffer != s->small_buffer)
     free_mem (s->buffer);
 
-  if (close (s->fd) < 0)
-    return FAILURE;
+  if (s->fd != STDOUT_FILENO && s->fd != STDERR_FILENO)
+    {
+      if (close (s->fd) < 0)
+        return FAILURE;
+    }
 
   free_mem (s);
 
2005-05-23  Francois-Xavier Coudert  <coudert@clipper.ens.fr>

	PR libfortran/20179
	* io/unix.c (fd_close): Add test so that we don't close()
	stdout and stderr.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]