From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: From: "Russ Cox" To: 9fans@cse.psu.edu Subject: Re: [9fans] fs error msg: didn't like (1460 274) byte message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Wed, 25 Sep 2002 14:24:23 -0400 Topicbox-Message-UUID: f4c5974e-eaca-11e9-9e20-41e7f4b1d025 The problem is the buffer can be arbitrarily sized, though typically 8192+IOHDRSZ is the max a client and server will agree on. Cpu uses a much larger max size to improve graphics performance. Here's a fixed xfer9p. I forgot that the initial count includes itself. void xfer9p(int from, int to) { char *buf; uint nbuf; int n; nbuf = 256; buf = malloc(nbuf); if(buf == nil) sysfatal("xfer: malloc %ud: %r", nbuf); for(;;){ if(readn(from, buf, 4) != 4) break; n = GBIT32(buf); if(n > nbuf){ nbuf = n+8192; /* 8192: slop */ buf = realloc(buf, nbuf); if(buf == nil) sysfatal("xfer: realloc %ud: %r", nbuf); } if(readn(from, buf+4, n-4) != n-4) break; if(write(to, buf, n) != n) break; } } Russ