]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libf2c/17636 ("truncation failed in endfile" error when closing a file appended to)
authorEric Botcazou <ebotcazou@libertysurf.fr>
Wed, 5 Jan 2005 06:53:52 +0000 (07:53 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 5 Jan 2005 06:53:52 +0000 (06:53 +0000)
PR libf2c/17636
* libI77/err.c (f__nowwriting): Call fseek if end-of-file.

From-SVN: r92924

libf2c/ChangeLog
libf2c/libI77/err.c

index 3a599225ca7ebd32b7842ca449610cf8e5bc1a92..320a070fb2081202dda27308fde086bab54f7a70 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-05  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR libf2c/17636
+       * libI77/err.c (f__nowwriting): Call fseek if end-of-file.
+
 2004-11-04  Release Manager
 
        * GCC 3.4.3 released.
index 1a204e820bc8fc2cd244e6f2d897b74c4e23763e..d643d3b8b687f389cb14710358e7931042dde595 100644 (file)
@@ -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;