Use freadptr's return value.
authorBruno Haible <bruno@clisp.org>
Sun, 30 Mar 2008 09:32:20 +0000 (11:32 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 30 Mar 2008 09:32:20 +0000 (11:32 +0200)
ChangeLog
lib/freadseek.c

index 4d73601fe219d3301a0f35aef736763563f107a2..e021282efb5759a9338341ea03dcda30bc282cc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-30  Bruno Haible  <bruno@clisp.org>
+
+       * lib/freadseek.c (freadseek): Don't ignore the return value of
+       freadptr.
+
 2008-03-29  Eric Blake  <ebb9@byu.net>
 
        Add hex float support.
index 37aeab706e4b70961f4a122fa52bfa814ccfb682..9e56ccc5791c8ac341c704fba9dda36f22cb2b93 100644 (file)
@@ -34,12 +34,11 @@ freadseek (FILE *fp, size_t offset)
     return 0;
 
   /* Increment the in-memory pointer.  This is very cheap (no system calls).  */
-  freadptr (fp, &buffered);
-  if (buffered > 0)
+  if (freadptr (fp, &buffered) != NULL && buffered > 0)
     {
       size_t increment = (buffered < offset ? buffered : offset);
 
-      /* Keep this code in sync with freadahead and freadptr!  */
+      /* Keep this code in sync with freadptr!  */
 #if defined _IO_ferror_unlocked     /* GNU libc, BeOS */
       fp->_IO_read_ptr += increment;
 #elif defined __sferror             /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */