summaryrefslogtreecommitdiff
path: root/sys/src/cmd/vnc
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-07-24 02:21:32 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2016-07-24 02:21:32 +0200
commita0d4c5e208405f84076891faaa43235bb2b87fc2 (patch)
tree9549cd4cd11c57e3c72d31f4a0424c75b1d5a063 /sys/src/cmd/vnc
parenta840b597cad282e837560b65dad89aa0cfd4af77 (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/vnc')
-rw-r--r--sys/src/cmd/vnc/exportfs.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/src/cmd/vnc/exportfs.c b/sys/src/cmd/vnc/exportfs.c
index 07e20e477..0c31d953d 100644
--- a/sys/src/cmd/vnc/exportfs.c
+++ b/sys/src/cmd/vnc/exportfs.c
@@ -149,10 +149,9 @@ exportproc(Export *fs)
errdepth(ed);
q = smalloc(sizeof(Exq));
- while((n = read9pmsg(fs->io, q->buf, Maxrpc)) == 0)
- ;
- if(n < 0 || convM2S(q->buf, n, &q->rpc) != n)
- goto bad;
+ n = read9pmsg(fs->io, q->buf, Maxrpc);
+ if(n <= 0 || convM2S(q->buf, n, &q->rpc) != n)
+ break;
if(exdebug)
print("export %d <- %F\n", getpid(), &q->rpc);
@@ -181,7 +180,6 @@ exportproc(Export *fs)
kproc("exportfs", exslave, nil);
rendwakeup(&exq.rwait);
}
-bad:
free(q);
if(exdebug)
fprint(2, "export proc shutting down: %r\n");