summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-26 19:27:11 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-26 19:27:11 +0000
commit467d94bc0406ef3824f778fadcea39038bd8a716 (patch)
treeed58975099dfe96e8daf9ff262535e7afe4c80db /libgfortran
parent512d32eeb34acde09bb97322bc6868b19db41bd1 (diff)
downloadgcc-467d94bc0406ef3824f778fadcea39038bd8a716.tar.gz
* io/rewind.c (st_rewind): Flush the stream when resetting the mode
from WRITING to READING. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98788 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog9
-rw-r--r--libgfortran/io/rewind.c10
2 files changed, 14 insertions, 5 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 027ad271f99..52f6c9f88fe 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,5 +1,10 @@
-2005-04-18 Paul Thomas <pault@gcc.gnu.org>
- Jerry DeLisle <jvdelisle@verizon.net>
+2005-04-26 David Edelsohn <edelsohn@gnu.org>
+
+ * io/rewind.c (st_rewind): Flush the stream when resetting the mode
+ from WRITING to READING.
+
+2005-04-22 Paul Thomas <pault@gcc.gnu.org>
+ Jerry DeLisle <jvdelisle@verizon.net>
* io/write.c (nml_write_obj): Provide 1 more byte for ext_name.
* io/list_read.c (nml_get_obj_data): Put extra brackets in get_mem
diff --git a/libgfortran/io/rewind.c b/libgfortran/io/rewind.c
index f0b0e90e454..48d57bafaa5 100644
--- a/libgfortran/io/rewind.c
+++ b/libgfortran/io/rewind.c
@@ -54,9 +54,13 @@ st_rewind (void)
/* If we have been writing to the file, the last written record
is the last record in the file, so truncate the file now.
Reset to read mode so two consecutive rewind statements
- don't delete the file contents. */
- if (u->mode==WRITING)
- struncate(u->s);
+ don't delete the file contents. Flush buffer when switching
+ mode. */
+ if (u->mode == WRITING)
+ {
+ flush (u->s);
+ struncate (u->s);
+ }
u->mode = READING;
u->last_record = 0;
if (sseek (u->s, 0) == FAILURE)