about summary refs log tree commit diff
path: root/src/internal/shgetc.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-11 00:26:41 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-11 00:26:41 -0400
commit7ef1a9bba56aa756d8166c4c93cf4a178d6c0c0c (patch)
tree100a71a49a72231a54a7484a5bb8f8c0e2dca51c /src/internal/shgetc.c
parent48bb81adf80a439133c376d50ea814687fb5169f (diff)
downloadmusl-7ef1a9bba56aa756d8166c4c93cf4a178d6c0c0c.tar.gz
musl-7ef1a9bba56aa756d8166c4c93cf4a178d6c0c0c.tar.xz
musl-7ef1a9bba56aa756d8166c4c93cf4a178d6c0c0c.zip
fix incorrect initial count in shgetc when data is already buffered
Diffstat (limited to 'src/internal/shgetc.c')
-rw-r--r--src/internal/shgetc.c2
1 files changed, 1 insertions, 1 deletions
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