On Wed, 23 Feb 2005, Hrvoje Niksic wrote:

> I see.  Now I know why I didn't use AC_FUNC_FSEEKO -- Wget doesn't use
> fseeko anywhere.  The only usage we have is:
> 
>     fseek (fp, 0, SEEK_END);
>     size = ftell (fp);         /* replaced with ftello where available */
> 
> Is there need to use fseeko here?

 Probably -- the Single Unix Specification, Version 2, which introduced 
the "o" functions, quotes this error code:

   [EOVERFLOW]
          For fseek(), the resulting file offset would be a value which
          cannot be represented correctly in an object of type long.

I don't know if it happens in practice (GNU libc seems to be forgiving, as 
usual).  But we do want to use ftello(), so we need AC_FUNC_FSEEKO anyway 
as the _LARGEFILE_SOURCE restriction applies to both.  This is what 
autoconf manual says (yes, a reference to ftello() should really be 
included in the AC_FUNC_FSEEKO description):

     The LFS introduced the `fseeko' and `ftello' functions to replace
     their C counterparts `fseek' and `ftell' that do not use `off_t'.
     Take care to use `AC_FUNC_FSEEKO' to make their prototypes
     available when using them and large-file support is enabled.

And if using ftello(), then we should probably use fseeko() as well, for 
consistency if nothing else.

  Maciej

Reply via email to