]> pd.if.org Git - pdclib/commitdiff
PDCLIB-13: fwrite did not reset it's offset after doing a buffer flush.
authorOwen Shepherd <owen.shepherd@e43.eu>
Wed, 10 Oct 2012 15:01:48 +0000 (16:01 +0100)
committerOwen Shepherd <owen.shepherd@e43.eu>
Wed, 10 Oct 2012 15:01:48 +0000 (16:01 +0100)
           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

index 89e9c03944f1c86a8cc11d2e0431b845d6e707d4..90c8f44eb3993307e5f6498da08adba71186824a 100644 (file)
@@ -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;
             }
         }
     }