re PR libfortran/20179 (cannot mix C and Fortran I/O)
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>
Mon, 30 May 2005 07:38:36 +0000 (09:38 +0200)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Mon, 30 May 2005 07:38:36 +0000 (07:38 +0000)
PR libfortran/20179
* io/unix.c (fd_close): Add test so that we don't close()
stdout and stderr.

From-SVN: r100353

libgfortran/ChangeLog
libgfortran/io/unix.c

index e816c31c70d0b1eb19990bd3f4a620fac49b2683..28f32b1a57bf6ef2f4c7a1dc2fca6e51b584a6bf 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2005-05-29  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        PR libfortran/20006
index 462d48df19aedcea9e5e6d67e21257e2aa4f939b..f82ffa7304178766a5f4700af60fea8439982731 100644 (file)
@@ -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);