Mercurial > hg > octave-shane > gnulib-hg
diff lib/stdio.in.h @ 12202:a0f033ee41af
fseek: avoid compilation failure when fflush is replaced
./gnulib-tool --import fseek fwritable failed on Debian, due
to broken fflush() pulling in rpl_fseeko that mistakenly
overwrote fseek() as function-like macro.
* m4/fseek.m4 (gl_REPLACE_FSEEK): New macro.
* m4/fseeko.m4 (gl_REPLACE_FSEEKO): Also replace fseek, if fseek
module is in use.
* lib/stdio.in.h (GNULIB_FSEEKO): Only poison fseek if fseek
module is not in use; since REPLACE_FSEEK worked otherwise.
(GNULIB_FTELLO): Likewise for ftell.
Reported by Ian Beckwith and others.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 27 Oct 2009 10:42:50 -0600 |
parents | 8e81b30aa8b7 |
children | be5edb878c7a |
line wrap: on
line diff
--- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -227,7 +227,14 @@ fflush(), and which detect pipes. */ # define fseeko rpl_fseeko extern int fseeko (FILE *fp, off_t offset, int whence); -# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence) +# if !@GNULIB_FSEEK@ +# undef fseek +# define fseek(f,o,w) \ + (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use fseeko function for handling of large files"), \ + fseeko (f, o, w)) +# endif # endif #elif defined GNULIB_POSIXCHECK # undef fseeko @@ -263,7 +270,14 @@ # if @REPLACE_FTELLO@ # define ftello rpl_ftello extern off_t ftello (FILE *fp); -# define ftell(fp) ftello (fp) +# if !@GNULIB_FTELL@ +# undef ftell +# define ftell(f) \ + (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use ftello function for handling of large files"), \ + ftello (f)) +# endif # endif #elif defined GNULIB_POSIXCHECK # undef ftello