ref: b450cb7e32ac9233d6d9225600feaf8b4a84301d
parent: 61dea9012e71b53b102e00a520ee0e8163b406d3
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Feb 14 20:03:44 EST 2016
devmnt: deal with partial response for Tversion request in mntversion()
--- a/sys/src/9/port/devmnt.c
+++ b/sys/src/9/port/devmnt.c
@@ -164,7 +164,6 @@
unlock(c);
l = devtab[c->type]->write(c, msg, k, oo);
-
if(l < k){
lock(c);
c->offset -= k - l;
@@ -173,13 +172,14 @@
}
/* message sent; receive and decode reply */
- k = devtab[c->type]->read(c, msg, 8192+IOHDRSZ, c->offset);
- if(k <= 0)
- error("EOF receiving fversion reply");
-
- lock(c);
- c->offset += k;
- unlock(c);
+ for(k = 0; k < BIT32SZ || (k < GBIT32(msg) && k < 8192+IOHDRSZ); k += l){
+ l = devtab[c->type]->read(c, msg+k, 8192+IOHDRSZ-k, c->offset);
+ if(l <= 0)
+ error("EOF receiving fversion reply");
+ lock(c);
+ c->offset += l;
+ unlock(c);
+ }
l = convM2S(msg, k, &f);
if(l != k)