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/ndb | |
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/ndb')
-rw-r--r-- | sys/src/cmd/ndb/cs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/src/cmd/ndb/cs.c b/sys/src/cmd/ndb/cs.c index 093df27cf..755efe4b1 100644 --- a/sys/src/cmd/ndb/cs.c +++ b/sys/src/cmd/ndb/cs.c @@ -321,14 +321,14 @@ mountinit(char *service, char *mntpt) procsetname("%s", mntpt); break; case -1: - error("fork failed\n"); + error("fork failed"); default: /* * put ourselves into the file system */ close(p[0]); if(mount(p[1], -1, mntpt, MAFTER, "") < 0) - error("mount failed\n"); + error("mount failed"); _exits(0); } mfd[0] = mfd[1] = p[0]; @@ -447,13 +447,13 @@ io(void) if(n < 0) error("mount read"); if(n == 0) - continue; + break; job = newjob(); if(convM2S(mdata, n, &job->request) != n){ syslog(1, logfile, "format error %ux %ux %ux %ux %ux", mdata[0], mdata[1], mdata[2], mdata[3], mdata[4]); freejob(job); - continue; + break; } qlock(&dblock); mf = newfid(job->request.fid); |