aboutsummaryrefslogtreecommitdiff
path: root/libio/iofopen.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-01-19 17:51:34 +0000
committerUlrich Drepper <drepper@redhat.com>2002-01-19 17:51:34 +0000
commit284749da8bfa7720960381f6681157f6ab44547d (patch)
tree04d7d91eb0790ff56bcda167adcd1f3e09ffeed5 /libio/iofopen.c
parent53e9699b6d8562d1f64bb16b558811b766da4e8b (diff)
downloadglibc-284749da8bfa7720960381f6681157f6ab44547d.tar
glibc-284749da8bfa7720960381f6681157f6ab44547d.tar.gz
glibc-284749da8bfa7720960381f6681157f6ab44547d.tar.bz2
glibc-284749da8bfa7720960381f6681157f6ab44547d.zip
Update.
2002-01-19 Ulrich Drepper <drepper@redhat.com> * libio/fileops.c (_IO_file_underflow_mmap): Don't define as static. Set offset if read end wasn't the buffer end. (_IO_file_seekoff_mmap): New function. (_IO_file_xsgetn_mmap): New function. (_IO_file_jumps_mmap): Use the two new functions. * libio/wfileops.c (_IO_wfile_underflow_mmap): Handle end read buffer != end buffer. * libio/libioP.h: Declare _IO_file_seekoff_mmap and _IO_file_underflow_mmap. * libio/iofopen.c: Don't position file descriptor at end of file. * libio/tst-widetext.c: Improve error messages. * stdio-common/tst-rndseek.c: Likewise.
Diffstat (limited to 'libio/iofopen.c')
-rw-r--r--libio/iofopen.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/libio/iofopen.c b/libio/iofopen.c
index e4821cbf0e..e3b9838195 100644
--- a/libio/iofopen.c
+++ b/libio/iofopen.c
@@ -67,25 +67,12 @@ __fopen_maybe_mmap (fp)
# endif
if (p != MAP_FAILED)
{
- if (
-# ifdef _G_LSEEK64
- _G_LSEEK64 (fp->_fileno, st.st_size, SEEK_SET)
-# else
- __lseek (fp->_fileno, st.st_size, SEEK_SET)
-# endif
- != st.st_size)
- {
- /* We cannot search the file. Don't mmap then. */
- __munmap (p, st.st_size);
- return fp;
- }
-
/* OK, we managed to map the file. Set the buffer up
and use a special jump table with simplified
underflow functions which never tries to read
anything from the file. */
_IO_setb (fp, p, (char *) p + st.st_size, 0);
- _IO_setg (fp, p, p, (char *) p + st.st_size);
+ _IO_setg (fp, p, p, p);
if (fp->_mode <= 0)
_IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_file_jumps_mmap;
@@ -93,7 +80,7 @@ __fopen_maybe_mmap (fp)
_IO_JUMPS ((struct _IO_FILE_plus *) fp) = &_IO_wfile_jumps_mmap;
fp->_wide_data->_wide_vtable = &_IO_wfile_jumps_mmap;
- fp->_offset = st.st_size;
+ fp->_offset = 0;
}
}
}