diff options
| author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-05-05 01:50:09 +0200 |
|---|---|---|
| committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-05-05 01:50:09 +0200 |
| commit | 7c1e0be91969ab0d8fca4bd1fd52de32f4a9a0c5 (patch) | |
| tree | 0d8f1316cb4ef39c50303fc1adbf59e3931de2af | |
| parent | ee289c241577a3553bfd73211cd81e137ab4fe40 (diff) | |
| download | plan9front-7c1e0be91969ab0d8fca4bd1fd52de32f4a9a0c5.tar.xz | |
cpu: properly handle end of file in readstr()
| -rw-r--r-- | sys/src/cmd/cpu.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/src/cmd/cpu.c b/sys/src/cmd/cpu.c index 3fb3a6d5e..f4083f315 100644 --- a/sys/src/cmd/cpu.c +++ b/sys/src/cmd/cpu.c @@ -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++; |
