diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-07-24 02:21:32 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-07-24 02:21:32 +0200 |
commit | a0d4c5e208405f84076891faaa43235bb2b87fc2 (patch) | |
tree | 9549cd4cd11c57e3c72d31f4a0424c75b1d5a063 /sys/src/cmd/cpu.c | |
parent | a840b597cad282e837560b65dad89aa0cfd4af77 (diff) |
make error handling in 9p service loops consistent
when we get eof, stop the loop immidiately and do not
rely on the read to eventually return an error.
when convM2S() fails to decode the message, error out
and stop the loop. there is no point in continuing.
Diffstat (limited to 'sys/src/cmd/cpu.c')
-rw-r--r-- | sys/src/cmd/cpu.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/sys/src/cmd/cpu.c b/sys/src/cmd/cpu.c index 1994aaf28..bc82316d9 100644 --- a/sys/src/cmd/cpu.c +++ b/sys/src/cmd/cpu.c @@ -1028,14 +1028,7 @@ notefs(int fd) ncpunote = 0; for(;;){ n = read9pmsg(fd, buf, sizeof(buf)); - if(n < 0){ - if(dbg) - fprint(2, "read9pmsg(%d) returns %d: %r\n", fd, n); - break; - } - if(n == 0) - continue; - if(convM2S(buf, n, &f) <= BIT16SZ) + if(n <= 0 || convM2S(buf, n, &f) != n) break; if(dbg) fprint(2, "notefs: ->%F\n", &f); |