summaryrefslogtreecommitdiff
path: root/libgfortran/io
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2005-05-11 07:56:20 +0200
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-05-11 05:56:20 +0000
commitda32fddcb6e41f878ea05dd46ad677a2d821c70e (patch)
treec9dbad5660c861798c7ad9d3bddd154215a4d446 /libgfortran/io
parent939176ab435c20964525b580056b85a20dd08ff1 (diff)
downloadgcc-da32fddcb6e41f878ea05dd46ad677a2d821c70e.tar.gz
re PR libfortran/21471 ('POSITION = "APPEND"' doesn't seem to work)
PR libfortran/21471 * open.c (new_unit): Take care of the case where POSITION_APPEND is specified (sseek to the end, and set u>-endfile). * gfortran.dg/append-1.f90: New test. From-SVN: r99560
Diffstat (limited to 'libgfortran/io')
-rw-r--r--libgfortran/io/open.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index 82a862b7c47..97bf6e4cc3d 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -356,6 +356,13 @@ new_unit (unit_flags * flags)
u->s = s;
u->flags = *flags;
+ if (flags->position == POSITION_APPEND)
+ {
+ if (sseek (u->s, file_length (u->s)) == FAILURE)
+ generate_error (ERROR_OS, NULL);
+ u->endfile = AT_ENDFILE;
+ }
+
/* Unspecified recl ends up with a processor dependent value. */
u->recl = (ioparm.recl_in != 0) ? ioparm.recl_in : g.max_offset;