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]

[gfortran] PR 20179


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?

Attachment: pr20179.ChangeLog
Description: Binary data

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);
 

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