The __freading behaviour in glibc has been fixed for glibc 2.7, including a unit test that verifies this behaviour. So, it's safe to use this glibc function now.
2007-10-13 Bruno Haible <[EMAIL PROTECTED]> * lib/freading.h (freading): Enable the use of __freading for glibc >= 2.7. * lib/freading.c (freading): Likewise. *** lib/freading.h.orig 2007-10-13 13:31:06.000000000 +0200 --- lib/freading.h 2007-10-13 13:31:06.000000000 +0200 *************** *** 32,38 **** STREAM must not be wide-character oriented. */ ! #if HAVE___FREADING && !defined __GLIBC__ /* Solaris >= 7, not glibc >= 2.2 */ # include <stdio_ext.h> # define freading(stream) (__freading (stream) != 0) --- 32,39 ---- STREAM must not be wide-character oriented. */ ! #if HAVE___FREADING && (!defined __GLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) ! /* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7 */ # include <stdio_ext.h> # define freading(stream) (__freading (stream) != 0) *** lib/freading.c.orig 2007-10-13 13:31:06.000000000 +0200 --- lib/freading.c 2007-10-13 13:31:06.000000000 +0200 *************** *** 19,27 **** /* Specification. */ #include "freading.h" ! /* Don't use glibc's __freading function, see <http://sourceware.org/bugzilla/show_bug.cgi?id=4359> */ ! #if !(HAVE___FREADING && !defined __GLIBC__) bool freading (FILE *fp) --- 19,27 ---- /* Specification. */ #include "freading.h" ! /* Don't use glibc's __freading function in glibc < 2.7, see <http://sourceware.org/bugzilla/show_bug.cgi?id=4359> */ ! #if !(HAVE___FREADING && (!defined __GLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))) bool freading (FILE *fp)