From 9f31fa9d8e6600f82bf61cd2a65c34784b3a38f4 Mon Sep 17 00:00:00 2001 From: aiju Date: Tue, 12 Jul 2011 17:51:34 +0200 Subject: [PATCH] have compiler error out if read fails --- sys/src/cmd/cc/lex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/src/cmd/cc/lex.c b/sys/src/cmd/cc/lex.c index 2652cb8f8..74054aa22 100644 --- a/sys/src/cmd/cc/lex.c +++ b/sys/src/cmd/cc/lex.c @@ -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;