GSoC/GCI Archive
Google Code-in 2010 Haiku

Fix fseek on Haiku - fseek does not discard ungetc buffer

completed by: Hamish Morrison

mentors: Jérôme Duval, Bruno Albuquerque, Philippe Houdoin

From Haiku trac ticket #3145:

ISO C 99 section specifies that "a successful call to the fseek function undoes any effects of the ungetc function on the stream". Same in POSIX, see


For this task you need to research how fseek is supposed to work, and then fix it on Haiku so that it works as it's expected to.  You will need to provide a patch file to fix the issue.  Once you think you have a working solution be sure to run the tests as suggested in the trac ticket.  Attach you patch to the trac ticket for review, and be prepared to make adjustments to it as requested.