From: Fredrik Tolf Date: Sun, 1 May 2016 02:57:51 +0000 (+0200) Subject: lib: Fixed another bufio bug. X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=commitdiff_plain;h=ba2bdc3d5ffd134ac468696b9fcdbc18ffc07270 lib: Fixed another bufio bug. --- 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);