about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-07-24 22:54:53 +0000
committerRoland McGrath <roland@gnu.org>2002-07-24 22:54:53 +0000
commit11d657d7278ae4f96f0f4c8655991f2818d0eeb9 (patch)
tree378af7b8cedd3f16aa99a35a9a976319499d4eab
parentbb0ec5bdb41599c8549613819653b29bb7298edb (diff)
downloadglibc-11d657d7278ae4f96f0f4c8655991f2818d0eeb9.tar.gz
glibc-11d657d7278ae4f96f0f4c8655991f2818d0eeb9.tar.xz
glibc-11d657d7278ae4f96f0f4c8655991f2818d0eeb9.zip
* libio/fileops.c (_IO_file_seekoff_mmap): Don't rely on FP->_offset,
	which gets moved around.  Calculate size of mmap'd buffer instead.
-rw-r--r--ChangeLog5
-rw-r--r--libio/fileops.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e292f18d04..f18226a604 100644
--- 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.
diff --git a/libio/fileops.c b/libio/fileops.c
index 1794dce57f..5603e5a30a 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -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)
     {