From da32fddcb6e41f878ea05dd46ad677a2d821c70e Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Wed, 11 May 2005 07:56:20 +0200 Subject: 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 --- libgfortran/io/open.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libgfortran/io/open.c') diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index 82a862b..97bf6e4 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; -- cgit v1.1