summaryrefslogtreecommitdiff
path: root/sys/src/cmd/exportfs
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-02-14 04:48:48 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-02-14 04:48:48 +0100
commit232a064f3a9afcd9a5c1de45f1558e4522c511bd (patch)
treefc3c304a692d4b8914ac2efbd532bf42555a16e7 /sys/src/cmd/exportfs
parenta9b1e990b8339d413aecaa00c5db743358caa42c (diff)
exportfs: properly reply to chdir() error when we speak 9p
when we got a bad root tree, we should speak the right language and return a Rerror response instead of crapping ascii into the 9p conversation.
Diffstat (limited to 'sys/src/cmd/exportfs')
-rw-r--r--sys/src/cmd/exportfs/exportfs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/src/cmd/exportfs/exportfs.c b/sys/src/cmd/exportfs/exportfs.c
index 8190f64b3..a01081847 100644
--- a/sys/src/cmd/exportfs/exportfs.c
+++ b/sys/src/cmd/exportfs/exportfs.c
@@ -249,8 +249,15 @@ main(int argc, char **argv)
}
else if(srv != nil) {
if(chdir(srv) < 0) {
+ ebuf[0] = '\0';
errstr(ebuf, sizeof ebuf);
- fprint(0, "chdir(\"%s\"): %s\n", srv, ebuf);
+ r = getsbuf();
+ r->work.tag = NOTAG;
+ r->work.fid = NOFID;
+ r->work.type = Rerror;
+ r->work.ename = ebuf;
+ n = convS2M(&r->work, r->buf, messagesize);
+ write(0, r->buf, n);
DEBUG(DFD, "chdir(\"%s\"): %s\n", srv, ebuf);
exits(ebuf);
}