diff options
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r-- | libgfortran/io/transfer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 4d4832395d9..f86a8527245 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1103,6 +1103,13 @@ data_transfer_init (int read_flag) generate_error (ERROR_OS, NULL); } + /* Overwriting an existing sequential file ? + it is always safe to truncate the file on the first write */ + if (g.mode == WRITING + && current_unit->flags.access == ACCESS_SEQUENTIAL + && current_unit->current_record == 0) + struncate(current_unit->s); + current_unit->mode = g.mode; /* Set the initial value of flags. */ |