summaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-02-16 09:45:20 +0000
committerRoland McGrath <roland@gnu.org>2005-02-16 09:45:20 +0000
commit095b6dedd9d05b4503c9c0c7fc1135057529b49d (patch)
tree2ad3b8dc44f881dce225796d19afde08fffa44cb /libio
parentec4876105040dce9cada213a9400a43800ab9ed9 (diff)
2005-01-19 Jakub Jelinek <jakub@redhat.com>
[BZ #730] * libio/iofopncook.c (_IO_cookie_seekoff): Add prototype. 2005-01-05 Ulrich Drepper <drepper@redhat.com> [BZ #730] * libio/iofopncook.c (_IO_cookie_seekoff): Define. Mark offset as invalid to disable optimizations in fileops which won't work here. (_IO_cookie_jumps): Use it. (_IO_old_cookie_jumps): Likewise. * libio/fmemopen.c (fmemopen_seek): Result must be returned in *P, not the return value. * stdio-common/Makefile (tests): Add tst-fmemopen2. * stdio-common/tst-fmemopen2.c: New file.
Diffstat (limited to 'libio')
-rw-r--r--libio/iofopncook.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index 321eb67b8d..6f720b43ef 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -36,6 +36,8 @@ static _IO_ssize_t _IO_cookie_read (register _IO_FILE* fp, void* buf,
static _IO_ssize_t _IO_cookie_write (register _IO_FILE* fp,
const void* buf, _IO_ssize_t size);
static _IO_off64_t _IO_cookie_seek (_IO_FILE *fp, _IO_off64_t offset, int dir);
+static _IO_off64_t _IO_cookie_seekoff (_IO_FILE *fp, _IO_off64_t offset,
+ int dir, int mode);
static int _IO_cookie_close (_IO_FILE* fp);
static _IO_ssize_t
@@ -94,6 +96,20 @@ _IO_cookie_close (fp)
}
+static _IO_off64_t
+_IO_cookie_seekoff (fp, offset, dir, mode)
+ _IO_FILE *fp;
+ _IO_off64_t offset;
+ int dir;
+ int mode;
+{
+ /* We must force the fileops code to always use seek to determine
+ the position. */
+ fp->_offset = _IO_pos_BAD;
+ return INTUSE(_IO_file_seekoff) (fp, offset, dir, mode);
+}
+
+
static const struct _IO_jump_t _IO_cookie_jumps = {
JUMP_INIT_DUMMY,
JUMP_INIT(finish, INTUSE(_IO_file_finish)),
@@ -103,7 +119,7 @@ static const struct _IO_jump_t _IO_cookie_jumps = {
JUMP_INIT(pbackfail, INTUSE(_IO_default_pbackfail)),
JUMP_INIT(xsputn, INTUSE(_IO_file_xsputn)),
JUMP_INIT(xsgetn, INTUSE(_IO_default_xsgetn)),
- JUMP_INIT(seekoff, INTUSE(_IO_file_seekoff)),
+ JUMP_INIT(seekoff, _IO_cookie_seekoff),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, INTUSE(_IO_file_setbuf)),
JUMP_INIT(sync, INTUSE(_IO_file_sync)),
@@ -223,7 +239,7 @@ static const struct _IO_jump_t _IO_old_cookie_jumps = {
JUMP_INIT(pbackfail, INTUSE(_IO_default_pbackfail)),
JUMP_INIT(xsputn, INTUSE(_IO_file_xsputn)),
JUMP_INIT(xsgetn, INTUSE(_IO_default_xsgetn)),
- JUMP_INIT(seekoff, INTUSE(_IO_file_seekoff)),
+ JUMP_INIT(seekoff, _IO_cookie_seekoff),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, INTUSE(_IO_file_setbuf)),
JUMP_INIT(sync, INTUSE(_IO_file_sync)),