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/cfs/cfs.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/cfs/cfs.c')
-rw-r--r-- | sys/src/cmd/cfs/cfs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/src/cmd/cfs/cfs.c b/sys/src/cmd/cfs/cfs.c index b11448be8..82a508684 100644 --- a/sys/src/cmd/cfs/cfs.c +++ b/sys/src/cmd/cfs/cfs.c @@ -808,14 +808,14 @@ rcvmsg(P9fs *p, Fcall *f) char buf[128]; olen = p->len; - while((p->len = read9pmsg(p->fd[0], datarcv, sizeof(datarcv))) == 0) - ; + p->len = read9pmsg(p->fd[0], datarcv, sizeof(datarcv)); + if(p->len == 0) + exits(""); if(p->len < 0){ snprint(buf, sizeof buf, "read9pmsg(%d)->%ld: %r", p->fd[0], p->len); error(buf); } - if((rlen = convM2S(datarcv, p->len, f)) != p->len) error("rcvmsg format error, expected length %d, got %d", rlen, p->len); |