diff options
author | jvdelisle <> | 2006-01-06 01:39:34 +0000 |
---|---|---|
committer | jvdelisle <> | 2006-01-06 01:39:34 +0000 |
commit | 7822f9c549eaaa93753faa51e7d4c92dc1c774cc (patch) | |
tree | 1b49be523e21bb74b123b6ac069be07266b1e925 /libgfortran/io/file_pos.c | |
parent | 3b7928ed42893f41fb2b26653f875442b3f9554c (diff) |
2006-01-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>c++-compat-branch
PR libgfortran/25598
* io/file_pos.c (unformatted_backspace): Assure the new file position
to seek is not less than zero.
(st_backspace): Set unit bytes_left to zero.
* io/transfer.c (next_record_r): Fix line lengths, no functional change.
Diffstat (limited to 'libgfortran/io/file_pos.c')
-rw-r--r-- | libgfortran/io/file_pos.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c index d9ac1e7f7ed..ba8f6317221 100644 --- a/libgfortran/io/file_pos.c +++ b/libgfortran/io/file_pos.c @@ -120,7 +120,9 @@ unformatted_backspace (st_parameter_filepos *fpp, gfc_unit *u) else reverse_memcpy (&m, p, sizeof (gfc_offset)); - new = file_position (u->s) - m - 2*length; + if ((new = file_position (u->s) - m - 2*length) < 0) + new = 0; + if (sseek (u->s, new) == FAILURE) goto io_error; @@ -179,6 +181,7 @@ st_backspace (st_parameter_filepos *fpp) u->endfile = NO_ENDFILE; u->current_record = 0; + u->bytes_left = 0; } done: |