1.3.3-2: fseek fails on multiples of 1024 (binary mode)

Christopher Faylor cgf@redhat.com
Tue Oct 23 20:22:00 GMT 2001


On Tue, Oct 23, 2001 at 11:07:03PM -0400, Christopher Faylor wrote:
>Is this fixed in more recent BSD code, perhaps?  Or has the code diverged too far
>for this to be useful?

Answering my own question: No, the code hasn't changed that much and
there seems to be one minor change in it, which is below.

Is it my imagination or does this actually fix the problem?  I haven't
studied the code that much but, from context, the patch makes sense.

cgf

Index: libc/stdio/fseek.c
===================================================================
RCS file: /cvs/uberbaum/newlib/libc/stdio/fseek.c,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 fseek.c
*** fseek.c	2000/02/17 19:39:47	1.1.1.1
--- fseek.c	2001/10/24 03:20:13
*************** fseek (fp, offset, whence)
*** 278,283 ****
--- 278,284 ----
    if ((*seekfn) (fp->_cookie, curoff, SEEK_SET) == POS_ERR)
      goto dumb;
    fp->_r = 0;
+   fp->_p = fp->_bf._base;
    if (HASUB (fp))
      FREEUB (fp);
    fp->_flags &= ~__SEOF;



More information about the Newlib mailing list