shithub: riscv

Download patch

ref: 633397bfda41efb7c3c9a4173cedfe8e45ea83a4
parent: 8e654cf76112ffe67ff1649fd0e570975a08a823
author: aiju <devnull@localhost>
date: Sun Mar 4 14:52:35 EST 2018

sshfs: update qid and filename on Tcreate

--- a/sys/src/cmd/sshfs.c
+++ b/sys/src/cmd/sshfs.c
@@ -934,7 +934,7 @@
 	SFid *sf;
 	int t, id;
 	u32int code;
-	char *msg, *lang, *hand;
+	char *msg, *lang, *hand, *s;
 	int msgn, langn, handn;
 	int okresp;
 	char *e;
@@ -1011,6 +1011,14 @@
 			sf->handn = handn;
 			sf->hand = emalloc9p(sf->handn);
 			memcpy(sf->hand, hand, sf->handn);
+			if(r->req->ifcall.type == Tcreate){
+				s = sf->fn;
+				sf->fn = pathcat(s, r->req->ifcall.name);
+				free(s);
+				sf->qid = (Qid){qidcalc(sf->fn), 0, (r->req->ifcall.perm & DMDIR) != 0 ? QTDIR : 0};
+				r->req->ofcall.qid = sf->qid;
+				r->req->fid->qid = sf->qid;
+			}
 			wunlock(sf);
 			if(r->req->ifcall.type == Tread){
 				r->req->aux = nil;