From: Ulrich Drepper Date: Thu, 25 Jul 2002 00:48:18 +0000 (+0000) Subject: (_IO_file_seekoff_mmap): Set fp->_offset after succesful seek call. Simply error... X-Git-Tag: cvs/glibc-2-3~611 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=66bff4092be47f02a6189f092b9dd1d8c6de2626;p=thirdparty%2Fglibc.git (_IO_file_seekoff_mmap): Set fp->_offset after succesful seek call. Simply error checking. --- diff --git a/libio/fileops.c b/libio/fileops.c index 5603e5a30a3..c054d5e7d02 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);