From e0f97db9eb84d304602eb35815ba9d188cd69e46 Mon Sep 17 00:00:00 2001 From: bstarynk Date: Tue, 25 Mar 2008 13:36:19 +0000 Subject: 2008-03-24 Basile Starynkevitch MELT branch merged with trunk r133512 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@133515 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/io/transfer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libgfortran/io') diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index c3e91149a27..5ccc95823a8 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1985,12 +1985,12 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag) if (dtp->u.p.mode == READING && dtp->u.p.current_unit->mode == WRITING && !is_internal_unit (dtp)) - flush(dtp->u.p.current_unit->s); + flush(dtp->u.p.current_unit->s); /* Check whether the record exists to be read. Only a partial record needs to exist. */ - if (dtp->u.p.mode == READING && (dtp->rec -1) + if (dtp->u.p.mode == READING && (dtp->rec - 1) * dtp->u.p.current_unit->recl >= file_length (dtp->u.p.current_unit->s)) { generate_error (&dtp->common, LIBERROR_BAD_OPTION, @@ -2604,7 +2604,9 @@ next_record_w (st_parameter_dt *dtp, int done) if (is_stream_io (dtp)) { dtp->u.p.current_unit->strm_pos += len; - struncate(dtp->u.p.current_unit->s); + if (dtp->u.p.current_unit->strm_pos + < file_length (dtp->u.p.current_unit->s)) + struncate (dtp->u.p.current_unit->s); } } -- cgit v1.2.1