From: Rich Felker Date: Wed, 11 Apr 2012 04:26:41 +0000 (-0400) Subject: fix incorrect initial count in shgetc when data is already buffered X-Git-Tag: v0.8.8~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ef1a9bba56aa756d8166c4c93cf4a178d6c0c0c;p=musl fix incorrect initial count in shgetc when data is already buffered --- diff --git a/src/internal/shgetc.c b/src/internal/shgetc.c index 7c4e58c1..82e3a4fa 100644 --- a/src/internal/shgetc.c +++ b/src/internal/shgetc.c @@ -3,7 +3,7 @@ void __shlim(FILE *f, off_t lim) { f->shlim = lim; - f->shcnt = f->rend ? f->rend - f->buf : 0; + f->shcnt = f->rend - f->rpos; if (lim && f->rend - f->rpos > lim) f->shend = f->rpos + lim; else