OSDN Git Service

PR libfortran/20179
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 May 2005 07:38:36 +0000 (07:38 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 May 2005 07:38:36 +0000 (07:38 +0000)
* io/unix.c (fd_close): Add test so that we don't close()
stdout and stderr.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100353 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/io/unix.c

index e816c31..28f32b1 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 462d48d..f82ffa7 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);