aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorBud Davis <bdavis9659@comcast.net>2005-01-15 08:10:23 +0000
committerBud Davis <bdavis@gcc.gnu.org>2005-01-15 08:10:23 +0000
commite1c74af03afbd2cc8de5b4777e8f40cab6eab4bf (patch)
tree5963b87a0b9a45d7b75baabd1f846f4092205bee /libgfortran
parent6a29dc8b1b22244e201d21a229f6171bd141c9f5 (diff)
downloadgcc-e1c74af03afbd2cc8de5b4777e8f40cab6eab4bf.zip
gcc-e1c74af03afbd2cc8de5b4777e8f40cab6eab4bf.tar.gz
gcc-e1c74af03afbd2cc8de5b4777e8f40cab6eab4bf.tar.bz2
re PR libfortran/18983 (can't open /dev/null as an output file)
2005-01-15 Bud Davis <bdavis9659@comcast.net> PR fortran/18983 * io/transfer.c (st_write_done): only truncate when it is required. 2005-01-15 Bud Davis <bdavis9659@comcast.net> PR fortran/18983 * gfortran.dg/write_to_null.f90: New test. From-SVN: r93689
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/transfer.c10
2 files changed, 13 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6c2b12e..c0534b8 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2005-01-15 Bud Davis <bdavis9659@comcast.net>
+
+ PR fortran/18983
+ * io/transfer.c (st_write_done): only truncate when it
+ is required.
+
2005-01-12 Toon Moene <toon@moene.indiv.nluug.nl>
PR libfortran/19280
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 73b0b9a..5454407 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -1557,9 +1557,13 @@ st_write_done (void)
current_unit->endfile = AT_ENDFILE; /* Just at it now. */
break;
- case NO_ENDFILE: /* Get rid of whatever is after this record. */
- if (struncate (current_unit->s) == FAILURE)
- generate_error (ERROR_OS, NULL);
+ case NO_ENDFILE:
+ if (current_unit->current_record > current_unit->last_record)
+ {
+ /* Get rid of whatever is after this record. */
+ if (struncate (current_unit->s) == FAILURE)
+ generate_error (ERROR_OS, NULL);
+ }
current_unit->endfile = AT_ENDFILE;
break;