Commit Diff


commit - 503f601cb052dc04b9e4e9e91f8e877f00c6b571
commit + 7cb748941ecffdd66630ba463080cf44fcb62161
blob - 6ed61a062d7fff355ba71e769974630b07d9a4e1
blob + fb0be905a29d371a39eaf3e900e7b20a01b548f6
--- src/libventi/cache.c
+++ src/libventi/cache.c
@@ -262,7 +262,8 @@ vtcachebumpblock(VtCache *c)
 	 */
 	if(c->nheap == 0){
 		vtcachedump(c);
-		sysfatal("vtcachebumpblock: no free blocks in vtCache");
+		fprint(2, "vtcachebumpblock: no free blocks in vtCache");
+		abort();
 	}
 	b = c->heap[0];
 	heapdel(b);
blob - a58b2089894f4894d12228f7b24fec1229212add
blob + 772b430f0fb7e18c4fe9e423832c30dd46286f95
--- src/libventi/client.c
+++ src/libventi/client.c
@@ -64,6 +64,9 @@ vtreadpacket(VtConn *z, uchar score[VtScoreSize], uint
 {
 	VtFcall tx, rx;
 
+	if(memcmp(score, vtzeroscore, VtScoreSize) == 0)
+		return packetalloc();
+
 	memset(&tx, 0, sizeof tx);
 	tx.type = VtTread;
 	tx.dtype = type;
@@ -107,6 +110,10 @@ vtwritepacket(VtConn *z, uchar score[VtScoreSize], uin
 {
 	VtFcall tx, rx;
 
+	if(packetsize(p) == 0){
+		memmove(score, vtzeroscore, VtScoreSize);
+		return 0;
+	}
 	tx.type = VtTwrite;
 	tx.dtype = type;
 	tx.data = p;
blob - ace8962a796ac437a821a3ea9c96b6ca40d47a0f
blob + 9e2fefa45c1eac61e718c8921e2ceead4aa87773
--- src/libventi/fcall.c
+++ src/libventi/fcall.c
@@ -226,5 +226,5 @@ vtfcallclear(VtFcall *f)
 	vtfree(f->auth);
 	f->auth = nil;
 	packetfree(f->data);
-	f->auth = nil;
+	f->data = nil;
 }
blob - 0b48707874b2b555032d65ba8f43468e56f62fdc
blob + dac53a51497332a35e300cbf34d9820f84f2d788
--- src/libventi/file.c
+++ src/libventi/file.c
@@ -98,6 +98,9 @@ vtfilealloc(VtCache *c, VtBlock *b, VtFile *p, u32int 
 		assert(mode == VtOREAD || p->mode == VtORDWR);
 		p->ref++;
 		qunlock(&p->lk);
+	}else{
+		assert(b->addr != NilBlock);
+		r->local = 1;
 	}
 	memmove(r->score, b->score, VtScoreSize);
 	r->offset = offset;
@@ -119,7 +122,6 @@ vtfileroot(VtCache *c, u32int addr, int mode)
 	b = vtcachelocal(c, addr, VtDirType);
 	if(b == nil)
 		return nil;
-
 	r = vtfilealloc(c, b, nil, 0, mode);
 	vtblockput(b);
 	return r;
@@ -1151,7 +1153,7 @@ vtfileflush(VtFile *f)
 
 	ret = flushblock(f->c, nil, e.score, e.psize/VtScoreSize, e.dsize/VtEntrySize,
 		e.type);
-	if(!ret){
+	if(ret < 0){
 		vtblockput(b);
 		return -1;
 	}