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/aux/consolefs.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/aux/consolefs.c')
-rw-r--r-- | sys/src/cmd/aux/consolefs.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/src/cmd/aux/consolefs.c b/sys/src/cmd/aux/consolefs.c index ebc5e1230..feef1eef3 100644 --- a/sys/src/cmd/aux/consolefs.c +++ b/sys/src/cmd/aux/consolefs.c @@ -681,18 +681,13 @@ fsrun(void *v) } free(d); r = allocreq(fs, messagesize); - while((n = read9pmsg(fs->fd, r->buf, messagesize)) == 0) - ; + n = read9pmsg(fs->fd, r->buf, messagesize); + if(n == 0) + threadexitsall("unmounted"); if(n < 0) - fatal("unmounted"); - - if(convM2S(r->buf, n, &r->f) == 0){ - fprint(2, "can't convert %ux %ux %ux\n", r->buf[0], - r->buf[1], r->buf[2]); - free(r); - continue; - } - + fatal("mount read: %r"); + if(convM2S(r->buf, n, &r->f) != n) + fatal("convM2S format error: %r"); f = fsgetfid(fs, r->f.fid); r->fid = f; |