summaryrefslogtreecommitdiff
path: root/src/internal/shgetc.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-16 01:55:37 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-16 01:55:37 -0400
commitf007bb854b0b2d2d12cd45a8feb674fa9abe70b2 (patch)
treec65aaf26f436fa5ebdba13453c3d8ece3a942026 /src/internal/shgetc.c
parent2ac580fdfe1daf9924f221dc98878ae480306bfa (diff)
downloadmusl-f007bb854b0b2d2d12cd45a8feb674fa9abe70b2.tar.gz
musl-f007bb854b0b2d2d12cd45a8feb674fa9abe70b2.tar.bz2
musl-f007bb854b0b2d2d12cd45a8feb674fa9abe70b2.tar.xz
musl-f007bb854b0b2d2d12cd45a8feb674fa9abe70b2.zip
fix broken shgetc limiter logic (wasn't working)
Diffstat (limited to 'src/internal/shgetc.c')
-rw-r--r--src/internal/shgetc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/internal/shgetc.c b/src/internal/shgetc.c
index 82e3a4fa..e85d38ac 100644
--- a/src/internal/shgetc.c
+++ b/src/internal/shgetc.c
@@ -13,7 +13,10 @@ void __shlim(FILE *f, off_t lim)
int __shgetc(FILE *f)
{
int c;
- if (f->shcnt >= f->shlim) return EOF;
+ if (f->shlim && f->shcnt >= f->shlim) {
+ f->shend = 0;
+ return EOF;
+ }
c = __uflow(f);
if (f->shlim && f->rend - f->rpos > f->shlim - f->shcnt - 1)
f->shend = f->rpos + (f->shlim - f->shcnt - 1);