From 4fd26de5783c8206ae17942ca350e29ad741f964 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 5 Jan 2005 07:53:52 +0100 Subject: [PATCH] re PR libf2c/17636 ("truncation failed in endfile" error when closing a file appended to) PR libf2c/17636 * libI77/err.c (f__nowwriting): Call fseek if end-of-file. From-SVN: r92924 --- libf2c/ChangeLog | 5 +++++ libf2c/libI77/err.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libf2c/ChangeLog b/libf2c/ChangeLog index 3a599225ca7e..320a070fb208 100644 --- a/libf2c/ChangeLog +++ b/libf2c/ChangeLog @@ -1,3 +1,8 @@ +2005-01-05 Eric Botcazou + + PR libf2c/17636 + * libI77/err.c (f__nowwriting): Call fseek if end-of-file. + 2004-11-04 Release Manager * GCC 3.4.3 released. diff --git a/libf2c/libI77/err.c b/libf2c/libI77/err.c index 1a204e820bc8..d643d3b8b687 100644 --- a/libf2c/libI77/err.c +++ b/libf2c/libI77/err.c @@ -239,7 +239,13 @@ f__nowwriting (unit * x) extern char *f__w_mode[]; if (x->urw & 2) - goto done; + { + /* Not required according to C99 7.19.5.3, but + this really helps on Solaris. */ + if (feof (x->ufd)) + FSEEK (x->ufd, 0, SEEK_END); + goto done; + } if (!x->ufnm) goto cantwrite; ufmt = x->url ? 0 : x->ufmt; -- 2.47.2