diff options
author | Bud Davis <bdavis9659@comcast.net> | 2005-01-15 08:10:23 +0000 |
---|---|---|
committer | Bud Davis <bdavis@gcc.gnu.org> | 2005-01-15 08:10:23 +0000 |
commit | e1c74af03afbd2cc8de5b4777e8f40cab6eab4bf (patch) | |
tree | 5963b87a0b9a45d7b75baabd1f846f4092205bee /libgfortran | |
parent | 6a29dc8b1b22244e201d21a229f6171bd141c9f5 (diff) | |
download | gcc-e1c74af03afbd2cc8de5b4777e8f40cab6eab4bf.tar.gz |
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/ChangeLog | 6 | ||||
-rw-r--r-- | libgfortran/io/transfer.c | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 6c2b12eaa6c..c0534b8ef44 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 73b0b9aba5f..54544079073 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; |