From ba2bdc3d5ffd134ac468696b9fcdbc18ffc07270 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sun, 1 May 2016 04:57:51 +0200 Subject: [PATCH] lib: Fixed another bufio bug. --- lib/bufio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/bufio.c b/lib/bufio.c index 83963b3..fe5d005 100644 --- a/lib/bufio.c +++ b/lib/bufio.c @@ -259,8 +259,10 @@ ssize_t biowritesome(struct bufio *bio, const void *data, size_t len) if(bio->wh == bio->wbuf.d) bio->wh = bio->wbuf.d = 0; if(bio->wbuf.d == bio->wbuf.s) { - if(bio->wh > 0) + if(bio->wh > 0) { memmove(bio->wbuf.b, bio->wbuf.b + bio->wh, bio->wbuf.d -= bio->wh); + bio->wh = 0; + } } ret = min(len, bio->wbuf.s - bio->wbuf.d); memcpy(bio->wbuf.b + bio->wbuf.d, data, ret); -- 2.11.0