From 844234fb50d86f0e03b6645bf40011d45a8ae65c Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Wed, 28 Dec 2005 20:58:08 +0000 Subject: re PR libfortran/25139 ("Invalid argument" error on I/O) 2005-12-28 Jerry DeLisle PR libgfortran/25139 * io/unix.c (fd_truncate): Set s->active to zero. PR libgfortran/25510 * libgfortran.h: Add ERROR_INTERNAL and ERROR_INTERNAL_UNIT. * runtime/error.c (translate_error): Add messages for new errors. * io/list_read.c (next_char): Use new errors. * io/transfer.c (next_record_r) (next_record_w): Use new errors. From-SVN: r109122 --- libgfortran/io/list_read.c | 2 +- libgfortran/io/transfer.c | 7 +++++-- libgfortran/io/unix.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'libgfortran/io') diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index b11f6a5..879cf8f 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -164,7 +164,7 @@ next_char (st_parameter_dt *dtp) check for NULL here is cautionary. */ if (p == NULL) { - generate_error (&dtp->common, ERROR_OS, NULL); + generate_error (&dtp->common, ERROR_INTERNAL_UNIT, NULL); return '\0'; } diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 7ad1fffc..2c12294 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1702,7 +1702,7 @@ next_record_r (st_parameter_dt *dtp) record = record * dtp->u.p.current_unit->recl; if (sseek (dtp->u.p.current_unit->s, record) == FAILURE) { - generate_error (&dtp->common, ERROR_OS, NULL); + generate_error (&dtp->common, ERROR_INTERNAL_UNIT, NULL); break; } dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl; @@ -1863,7 +1863,10 @@ next_record_w (st_parameter_dt *dtp, int done) record = record * dtp->u.p.current_unit->recl; if (sseek (dtp->u.p.current_unit->s, record) == FAILURE) - goto io_error; + { + generate_error (&dtp->common, ERROR_INTERNAL_UNIT, NULL); + return; + } dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl; } diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 6750b6f..237f09e 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -601,7 +601,7 @@ fd_truncate (unix_stream * s) } s->physical_offset = s->file_length = s->logical_offset; - + s->active = 0; return SUCCESS; } -- cgit v1.1