bug-gnulib
[Top][All Lists]
Advanced

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

Re: fseeko bug


From: Larry Jones
Subject: Re: fseeko bug
Date: Thu, 13 Dec 2007 15:24:57 -0500 (EST)

Eric Blake writes:
> 
> Just to make sure other platforms aren't affected, I'm installing this.

Looks good.  You might want to consider adding tests to make sure that
any pending ungetc() data is cleared like it's supposed to be.  I don't
see any code that obviously does that, so I suspect it's not.

On a more general note, it looks like fseeko and ftello both need more
work to be generally useful on platforms that have a wide off_t but
don't have native fseeko/ftello.  fseeko does the right thing when it
can work its magic, but it falls back to just calling fseek when it
can't, which will do the wrong thing if the offset doesn't fit in a
long.  ftello always just returns the result of ftell, which again isn't
right if the current position doesn't fit in a long.  It might be
possible to finesse fseeko by just calling fseek(fp, 0, SEEK_CUR) prior
to the magic in hopes that it will undo all the stuff that would keep
the magic from working (which would also have the pleasant side effect
of undoing any ungetc data and clearing the EOF flag), but there's no
easy fix for ftello.

-Larry Jones

They can make me do it, but they can't make me do it with dignity. -- Calvin




reply via email to

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