have compiler error out if read fails

This commit is contained in:
aiju 2011-07-12 17:51:34 +02:00
parent 2d288b4002
commit 9f31fa9d8e

View file

@ -1262,7 +1262,9 @@ loop:
if(i->f < 0)
goto pop;
fi.c = read(i->f, i->b, BUFSIZ) - 1;
if(fi.c < 0) {
if(fi.c < -1)
sysfatal("read error: %r");
if(fi.c == -1) {
close(i->f);
linehist(0, 0);
goto pop;