diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-07-25 00:48:18 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-07-25 00:48:18 +0000 |
commit | 66bff4092be47f02a6189f092b9dd1d8c6de2626 (patch) | |
tree | 2493e439297a6a10bccefeb6b0154783b7bae38e /libio | |
parent | a753ffb296bb8c18c876d978e5878e6bd3538d2c (diff) | |
download | glibc-66bff4092be47f02a6189f092b9dd1d8c6de2626.zip glibc-66bff4092be47f02a6189f092b9dd1d8c6de2626.tar.gz glibc-66bff4092be47f02a6189f092b9dd1d8c6de2626.tar.bz2 |
(_IO_file_seekoff_mmap): Set fp->_offset after succesful seek call. Simply error checking.
Diffstat (limited to 'libio')
-rw-r--r-- | libio/fileops.c | 13 |
1 files 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); |