shithub: riscv

Download patch

ref: 9f31fa9d8e6600f82bf61cd2a65c34784b3a38f4
parent: 2d288b400241451febf419d3238140084ca7fd1d
author: aiju <[email protected]>
date: Tue Jul 12 13:51:34 EDT 2011

have compiler error out if read fails

--- a/sys/src/cmd/cc/lex.c
+++ b/sys/src/cmd/cc/lex.c
@@ -1262,7 +1262,9 @@
 	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;