From dce83cc9963794572709bbc3c95a462c33be18c1 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Wed, 10 Oct 2012 16:01:48 +0100 Subject: [PATCH] PDCLIB-13: fwrite did not reset it's offset after doing a buffer flush. TODO: Evaluate if fwrite should move to using an offset stored inside the FILE structure Patch submitted by Rink Springer (complexity: trivial) --- functions/stdio/fwrite.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/functions/stdio/fwrite.c b/functions/stdio/fwrite.c index 89e9c03..90c8f44 100644 --- a/functions/stdio/fwrite.c +++ b/functions/stdio/fwrite.c @@ -44,6 +44,12 @@ size_t fwrite( const void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, str return nmemb_i; } //lineend = false; + /* + * The entire buffer has been flushed; this means we have to + * reset our newline position as we have already written + * that part of the stream. + */ + offset = 0; } } } -- 2.40.0