diff --git a/src/parser.c b/src/parser.c
index 6f12456ddbe5248b59ea146464a1d76365505c56..fa3b798c8b81b77434bc7beff94902f6c78a4c3e 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -44,9 +44,7 @@ assert(p->buf);
}
int n = p->read(p->state, &p->buf[p->bufln], p->bufsz - p->bufln - 1);
- if (n == -1) {
- return -1;
- } else if (n == 0) {
+ if (n < 1) {
eof = p->bufln == 0;
break;
}