From 66bff4092be47f02a6189f092b9dd1d8c6de2626 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 25 Jul 2002 00:48:18 +0000 Subject: [PATCH] (_IO_file_seekoff_mmap): Set fp->_offset after succesful seek call. Simply error checking. --- libio/fileops.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libio/fileops.c b/libio/fileops.c index 5603e5a..c054d5e 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -940,11 +940,6 @@ _IO_file_seekoff_mmap (fp, offset, dir, mode) case _IO_seek_cur: /* Adjust for read-ahead (bytes is buffer). */ offset += fp->_IO_read_ptr - fp->_IO_read_base; - if (offset < 0) - { - __set_errno (EINVAL); - return EOF; - } break; case _IO_seek_set: break; @@ -955,8 +950,11 @@ _IO_file_seekoff_mmap (fp, offset, dir, mode) /* At this point, dir==_IO_seek_set. */ if (offset < 0) - /* No negative offsets are valid. */ - return EOF; + { + /* No negative offsets are valid. */ + __set_errno (EINVAL); + return EOF; + } result = _IO_SYSSEEK (fp, offset, 0); if (result < 0) @@ -964,6 +962,7 @@ _IO_file_seekoff_mmap (fp, offset, dir, mode) _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + offset, fp->_IO_buf_base + offset); + fp->_offset = result; _IO_mask_flags (fp, 0, _IO_EOF_SEEN); -- 2.7.4