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/rio/fsys.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/rio/fsys.c')
-rw-r--r-- | sys/src/cmd/rio/fsys.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/src/cmd/rio/fsys.c b/sys/src/cmd/rio/fsys.c index c1ab79b53..3c1749910 100644 --- a/sys/src/cmd/rio/fsys.c +++ b/sys/src/cmd/rio/fsys.c @@ -195,9 +195,8 @@ filsysproc(void *arg) buf = malloc(messagesize+UTFmax); /* UTFmax for appending partial rune in xfidwrite */ if(buf == nil) error(Enomem); - while((n = read9pmsg(fs->sfd, buf, messagesize)) == 0) - yield(); - if(n < 0){ + n = read9pmsg(fs->sfd, buf, messagesize); + if(n <= 0){ yield(); /* if threadexitsall'ing, will not return */ fprint(2, "rio: %d: read9pmsg: %d %r\n", getpid(), n); errorshouldabort = 0; |