diff options
Diffstat (limited to 'src/stdio/fgetln.c')
-rw-r--r-- | src/stdio/fgetln.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/fgetln.c b/src/stdio/fgetln.c index afe12b5d..5748435d 100644 --- a/src/stdio/fgetln.c +++ b/src/stdio/fgetln.c @@ -8,7 +8,7 @@ char *fgetln(FILE *f, size_t *plen) ssize_t l; FLOCK(f); ungetc(getc_unlocked(f), f); - if ((z=memchr(f->rpos, '\n', f->rend - f->rpos))) { + if (f->rend && (z=memchr(f->rpos, '\n', f->rend - f->rpos))) { ret = (char *)f->rpos; *plen = ++z - ret; f->rpos = (void *)z; |