summaryrefslogtreecommitdiff
path: root/libgfortran/io
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-30 07:38:36 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-30 07:38:36 +0000
commitf8f6940b4e0d5ea445f58cde14a8663f5f061f7f (patch)
tree1defe98805a925a82cfb7499d93475e932eb0644 /libgfortran/io
parent6bdb9842a393c1ba7840fc770b2417797369b4a2 (diff)
downloadgcc-f8f6940b4e0d5ea445f58cde14a8663f5f061f7f.tar.gz
PR libfortran/20179
* 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
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/unix.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 462d48df19a..f82ffa73041 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -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);