aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2005-05-30 09:38:36 +0200
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-05-30 07:38:36 +0000
commit12e59662e3a2bd79854bbf4fa84b30182196d403 (patch)
tree1defe98805a925a82cfb7499d93475e932eb0644 /libgfortran
parent66859ace3123cee9186238e5b32af3ae4304f22f (diff)
downloadgcc-12e59662e3a2bd79854bbf4fa84b30182196d403.zip
gcc-12e59662e3a2bd79854bbf4fa84b30182196d403.tar.gz
gcc-12e59662e3a2bd79854bbf4fa84b30182196d403.tar.bz2
re PR libfortran/20179 (cannot mix C and Fortran I/O)
PR libfortran/20179 * io/unix.c (fd_close): Add test so that we don't close() stdout and stderr. From-SVN: r100353
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/unix.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index e816c31..28f32b1 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -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
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 462d48d..f82ffa7 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);