#3145: fseek does not discard ungetc buffer --------------------------------+----------------------------- Reporter: bhaible | Owner: zooey Type: bug | Status: in-progress Priority: normal | Milestone: R1 Component: System/libroot.so | Version: R1/pre-alpha1 Resolution: | Keywords: Blocked By: | Has a Patch: 1 Platform: All | Blocking: --------------------------------+----------------------------- Comment (by zooey): Replying to [comment:6 hamish]: > _IO_buf_base points to the start of the entire stream buffer, while _IO_read_base points to the start of the read part of the stream buffer. ungetc() and friends store characters in the bytes between _IO_buf_base and _IO_read_base, so the seek function must take these into account and skip them. Not quite, no: ungetc() invokes _IO_sputbackc(), which puts back characters between _IO_read_ptr and _IO_read_base - _IO_buf_base doesn't play any role there. That's why I still fail to understand what exactly your patch does that causes the good effect. More importantly, I'm not at all sure it doesn't actually break other use cases. Have you tried running all gnulib tests to see if applying your patch doesn't introduce new problems? -- Ticket URL: <http://dev.haiku-os.org/ticket/3145#comment:7> Haiku <http://dev.haiku-os.org> Haiku - the operating system.