From 7ef1a9bba56aa756d8166c4c93cf4a178d6c0c0c Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 11 Apr 2012 00:26:41 -0400 Subject: [PATCH] fix incorrect initial count in shgetc when data is already buffered --- src/internal/shgetc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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