[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fseek failing without fflush?

From: Bruno Haible
Subject: Re: fseek failing without fflush?
Date: Tue, 9 Aug 2011 23:45:32 +0200
User-agent: KMail/1.13.6 (Linux/; KDE/4.6.0; x86_64; ; )

Hi Eric,

> Found it.  And the fix is embarrassingly simple - we were simply failing 
> to update the stream position to match the fd position:
> @@ -111,6 +107,7 @@ fseeko (FILE *fp, off_t offset, int whence)
>   #if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, 
> BeOS, Haiku, Linux libc5 */
>         fp->_flags &= ~_IO_EOF_SEEN;
> +      fp->_offset = pos;

Yup. I found this solution as well, at the same time.

> And in fact, it turns out I asked Bruno about it a couple years ago!  He 
> had special-cased some code in ftello.c in order to make a test pass 
> under glibc, without understanding the real reason why he was getting 
> the testsuite failures:
> https://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00171.html
> This means that the real fix for this issue should undo the hacks, since 
> the testsuite was already robust enough to catch this problem and we had 
> just hacked around it, rather than having to also worry about enhancing 
> test-ftello.c.  Final patch coming soon.

OK, can we commit the simple one-liner fix nevertheless first, for the
record? And the test case as well? I'm preparing a patch.

In memoriam Franz Jägerstätter <http://en.wikipedia.org/wiki/Franz_Jägerstätter>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]