summaryrefslogtreecommitdiff
path: root/libgfortran/io/file_pos.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/file_pos.c')
-rw-r--r--libgfortran/io/file_pos.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index 05bb42dc804..3f6a332d979 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -205,7 +205,7 @@ st_backspace (st_parameter_filepos *fpp)
sequential I/O and the next direct access transfer repositions the file
anyway. */
- if (u->flags.access == ACCESS_DIRECT)
+ if (u->flags.access == ACCESS_DIRECT || u->flags.access == ACCESS_STREAM)
goto done;
/* Check for special cases involving the ENDFILE record first. */
@@ -291,7 +291,7 @@ st_rewind (st_parameter_filepos *fpp)
u = find_unit (fpp->common.unit);
if (u != NULL)
{
- if (u->flags.access != ACCESS_SEQUENTIAL)
+ if (u->flags.access == ACCESS_DIRECT)
generate_error (&fpp->common, ERROR_BAD_OPTION,
"Cannot REWIND a file opened for DIRECT access");
else
@@ -301,7 +301,7 @@ st_rewind (st_parameter_filepos *fpp)
file now. Reset to read mode so two consecutive rewind
statements do not delete the file contents. */
flush (u->s);
- if (u->mode == WRITING)
+ if (u->mode == WRITING && u->flags.access != ACCESS_STREAM)
struncate (u->s);
u->mode = READING;