From bd2a7a1a4436ff417d44e472805807641f1d0b3a Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sat, 1 Jan 2011 19:04:32 +0000 Subject: [PATCH] Closing #3145: * apply a patch by hamish (as part of GCI) that lets fseek() discard characters pushed onto the stream via ungetc() git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40055 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/glibc/libio/fileops.c | 4 ++-- src/system/libroot/posix/glibc/libio/wfileops.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/system/libroot/posix/glibc/libio/fileops.c b/src/system/libroot/posix/glibc/libio/fileops.c index 2297883f47..ad75784c37 100644 --- a/src/system/libroot/posix/glibc/libio/fileops.c +++ b/src/system/libroot/posix/glibc/libio/fileops.c @@ -1028,14 +1028,14 @@ _IO_new_file_seekoff (fp, offset, dir, mode) { /* Offset relative to start of main get area. */ _IO_off64_t rel_offset = (offset - fp->_offset - + (fp->_IO_read_end - fp->_IO_read_base)); + + (fp->_IO_read_end - fp->_IO_buf_base)); if (rel_offset >= 0) { #if 0 if (_IO_in_backup (fp)) _IO_switch_to_main_get_area (fp); #endif - if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base) + if (rel_offset <= fp->_IO_read_end - fp->_IO_buf_base) { _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset, fp->_IO_read_end); diff --git a/src/system/libroot/posix/glibc/libio/wfileops.c b/src/system/libroot/posix/glibc/libio/wfileops.c index c5ed49a528..6c30b39b87 100644 --- a/src/system/libroot/posix/glibc/libio/wfileops.c +++ b/src/system/libroot/posix/glibc/libio/wfileops.c @@ -638,14 +638,14 @@ _IO_wfile_seekoff (fp, offset, dir, mode) { /* Offset relative to start of main get area. */ _IO_off64_t rel_offset = (offset - fp->_offset - + (fp->_IO_read_end - fp->_IO_read_base)); + + (fp->_IO_read_end - fp->_IO_buf_base)); if (rel_offset >= 0) { #if 0 if (_IO_in_backup (fp)) _IO_switch_to_main_get_area (fp); #endif - if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base) + if (rel_offset <= fp->_IO_read_end - fp->_IO_buf_base) { enum __codecvt_result status; struct _IO_codecvt *cd = fp->_codecvt;