This fixes a test-freading failure on glibc systems that was present for a few days already.
2007-04-29 Bruno Haible <[EMAIL PROTECTED]> * lib/freading.h: Improve comments. * lib/fwriting.h: Likewise. * tests/test-freading.c (main): Don't check freading immediately after repositioning. Needed for glibc. *** lib/freading.h 27 Apr 2007 18:05:08 -0000 1.2 --- lib/freading.h 29 Apr 2007 08:34:22 -0000 *************** *** 24,33 **** writing and there is no current read operation (such as fputc). freading and fwriting will never both be true. If STREAM supports ! both reads and writes, then both freading and fwriting might be ! false when the stream is first opened, after repositioning (such as ! fseek, fsetpos, or rewind), after read encounters EOF, or after ! fflush, depending on the underlying implementation. STREAM must not be wide-character oriented. */ --- 24,35 ---- writing and there is no current read operation (such as fputc). freading and fwriting will never both be true. If STREAM supports ! both reads and writes, then: ! - both freading and fwriting might be false when the stream is first ! opened, after read encounters EOF, or after fflush, ! - freading might be false or true and fwriting might be false ! after repositioning (such as fseek, fsetpos, or rewind), ! depending on the underlying implementation. STREAM must not be wide-character oriented. */ *** lib/fwriting.h 27 Apr 2007 18:05:08 -0000 1.2 --- lib/fwriting.h 29 Apr 2007 08:34:22 -0000 *************** *** 25,34 **** as fputc). freading and fwriting will never both be true. If STREAM supports ! both reads and writes, then both freading and fwriting might be ! false when the stream is first opened, after repositioning (such as ! fseek, fsetpos, or rewind), after read encounters EOF, or after ! fflush, depending on the underlying implementation. STREAM must not be wide-character oriented. */ --- 25,36 ---- as fputc). freading and fwriting will never both be true. If STREAM supports ! both reads and writes, then: ! - both freading and fwriting might be false when the stream is first ! opened, after read encounters EOF, or after fflush, ! - freading might be false or true and fwriting might be false ! after repositioning (such as fseek, fsetpos, or rewind), ! depending on the underlying implementation. STREAM must not be wide-character oriented. */ *** tests/test-freading.c 29 Apr 2007 07:44:02 -0000 1.3 --- tests/test-freading.c 29 Apr 2007 08:34:22 -0000 *************** *** 97,103 **** ASSERT (!freading (fp)); if (fseek (fp, 0, SEEK_END)) goto skip; ! ASSERT (!freading (fp)); if (fclose (fp)) goto skip; --- 97,105 ---- ASSERT (!freading (fp)); if (fseek (fp, 0, SEEK_END)) goto skip; ! /* freading (fp) is undefined here, because on some implementations (e.g. ! glibc) fseek causes a buffer to be read. ! fwriting (fp) is undefined as well. */ if (fclose (fp)) goto skip; *************** *** 135,141 **** ASSERT (!freading (fp)); if (fseek (fp, 0, SEEK_END)) goto skip; ! ASSERT (!freading (fp)); if (fclose (fp)) goto skip; --- 137,145 ---- ASSERT (!freading (fp)); if (fseek (fp, 0, SEEK_END)) goto skip; ! /* freading (fp) is undefined here, because on some implementations (e.g. ! glibc) fseek causes a buffer to be read. ! fwriting (fp) is undefined as well. */ if (fclose (fp)) goto skip; *** tests/test-fwriting.c 29 Apr 2007 07:44:02 -0000 1.3 --- tests/test-fwriting.c 29 Apr 2007 08:34:22 -0000 *************** *** 97,103 **** ASSERT (fwriting (fp)); if (fseek (fp, 0, SEEK_END)) goto skip; ! /* fwriting (fp) is undefined here, but freading (fp) is false. */ if (fclose (fp)) goto skip; --- 97,105 ---- ASSERT (fwriting (fp)); if (fseek (fp, 0, SEEK_END)) goto skip; ! /* freading (fp) is undefined here, because on some implementations (e.g. ! glibc) fseek causes a buffer to be read. ! fwriting (fp) is undefined as well. */ if (fclose (fp)) goto skip; *************** *** 135,141 **** ASSERT (fwriting (fp)); if (fseek (fp, 0, SEEK_END)) goto skip; ! /* fwriting (fp) is undefined here, but freading (fp) is false. */ if (fclose (fp)) goto skip; --- 137,145 ---- ASSERT (fwriting (fp)); if (fseek (fp, 0, SEEK_END)) goto skip; ! /* freading (fp) is undefined here, because on some implementations (e.g. ! glibc) fseek causes a buffer to be read. ! fwriting (fp) is undefined as well. */ if (fclose (fp)) goto skip;