~kris/9p

9hist

1cf62785d11ca9c07893c67d4d9285f2ae96951a — David du Colombier 30 years ago ae76db6
Plan 9 from Bell Labs 1996-03-29
1 files changed, 12 insertions(+), 16 deletions(-)

M port/cache.c
M port/cache.c => port/cache.c +12 -16
@@ 526,23 526,19 @@ cwrite(Chan* c, uchar *buf, int len, ulong offset)
		p = f;		
	}

	if(f != 0) {
	if(f != 0 && offset < f->start+f->len) {
		o = offset - f->start;
		if(o >= 0) {
			n = f->len - o;
			if(n > len)
				n = len;
			if(n > 0) {
				if(cpgmove(f, buf, o, n)) {
					buf += n;
					len -= n;
					offset += n;
				}
				if(len == 0) {
					qunlock(m);
					return;
				}
			}	
		n = f->len - o;
		if(n > len)
			n = len;
		if(cpgmove(f, buf, o, n)) {
			len -= n;
			if(len == 0) {
				qunlock(m);
				return;
			}
			offset += n;
			buf += n;
		}
	}