~mcf/plan9front

d910925857eb139fa7afad05893993c9cdd44ec8 — 5 months ago fc5cb22
cpu: properly handle end of file in readstr()
1 files changed, 4 insertions(+), 0 deletions(-)

M sys/src/cmd/cpu.c
M sys/src/cmd/cpu.c => sys/src/cmd/cpu.c +4 -0
@@ 430,6 430,10 @@ readstr(int fd, char *str, int len)
		n = read(fd, str, 1);
		if(n < 0) 
			return -1;
		if(n == 0){
			werrstr("hung up");
			return -1;
		}
		if(*str == '\0')
			return 0;
		str++;