about summary refs log tree commit diff
diff options
context:
space:
mode:
-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