* libio/fileops.c (_IO_file_seekoff_mmap): Don't rely on FP->_offset,
authorRoland McGrath <roland@gnu.org>
Wed, 24 Jul 2002 22:54:53 +0000 (22:54 +0000)
committerRoland McGrath <roland@gnu.org>
Wed, 24 Jul 2002 22:54:53 +0000 (22:54 +0000)
which gets moved around.  Calculate size of mmap'd buffer instead.

ChangeLog
libio/fileops.c

index e292f18..f18226a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-24  Roland McGrath  <roland@frob.com>
+
+       * libio/fileops.c (_IO_file_seekoff_mmap): Don't rely on FP->_offset,
+       which gets moved around.  Calculate size of mmap'd buffer instead.
+
 2002-07-24  Philip Blundell  <philb@gnu.org>
 
        * sysdeps/unix/arm/brk.S: Improve schedule.
index 1794dce..5603e5a 100644 (file)
@@ -932,7 +932,8 @@ _IO_file_seekoff_mmap (fp, offset, dir, mode)
      using a pushback buffer, but in the usual case has the same value as
      (fp->_IO_read_ptr - fp->_IO_buf_base).  */
   if (mode == 0)
-    return fp->_offset - (fp->_IO_read_end - fp->_IO_read_ptr);
+    return ((fp->_IO_buf_end - fp->_IO_buf_base)
+           - (fp->_IO_read_end - fp->_IO_read_ptr));
 
   switch (dir)
     {