This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [gfortran] PR 20179
- From: FX Coudert <fxcoudert at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 29 May 2005 14:50:43 +0200
- Subject: Re: [gfortran] PR 20179
- References: <4292C729.1030500@gmail.com>
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.