ref: 232a064f3a9afcd9a5c1de45f1558e4522c511bd
parent: a9b1e990b8339d413aecaa00c5db743358caa42c
author: cinap_lenrek <[email protected]>
date: Sat Feb 13 23:48:48 EST 2016
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.
--- a/sys/src/cmd/exportfs/exportfs.c
+++ b/sys/src/cmd/exportfs/exportfs.c
@@ -249,8 +249,15 @@
}
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);
}