aboutsummaryrefslogtreecommitdiff
path: root/src/libventi
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-06-17 18:51:50 +0000
committerrsc <devnull@localhost>2004-06-17 18:51:50 +0000
commit7cb748941ecffdd66630ba463080cf44fcb62161 (patch)
tree2372759d9836da41b3317cc3a3feb66613c94142 /src/libventi
parent503f601cb052dc04b9e4e9e91f8e877f00c6b571 (diff)
downloadplan9port-7cb748941ecffdd66630ba463080cf44fcb62161.tar.gz
plan9port-7cb748941ecffdd66630ba463080cf44fcb62161.tar.bz2
plan9port-7cb748941ecffdd66630ba463080cf44fcb62161.zip
little bug fixes
Diffstat (limited to 'src/libventi')
-rw-r--r--src/libventi/cache.c3
-rw-r--r--src/libventi/client.c7
-rw-r--r--src/libventi/fcall.c2
-rw-r--r--src/libventi/file.c6
4 files changed, 14 insertions, 4 deletions
diff --git a/src/libventi/cache.c b/src/libventi/cache.c
index 6ed61a06..fb0be905 100644
--- a/src/libventi/cache.c
+++ b/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);
diff --git a/src/libventi/client.c b/src/libventi/client.c
index a58b2089..772b430f 100644
--- a/src/libventi/client.c
+++ b/src/libventi/client.c
@@ -64,6 +64,9 @@ vtreadpacket(VtConn *z, uchar score[VtScoreSize], uint type, int n)
{
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], uint type, Packet *p)
{
VtFcall tx, rx;
+ if(packetsize(p) == 0){
+ memmove(score, vtzeroscore, VtScoreSize);
+ return 0;
+ }
tx.type = VtTwrite;
tx.dtype = type;
tx.data = p;
diff --git a/src/libventi/fcall.c b/src/libventi/fcall.c
index ace8962a..9e2fefa4 100644
--- a/src/libventi/fcall.c
+++ b/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;
}
diff --git a/src/libventi/file.c b/src/libventi/file.c
index 0b487078..dac53a51 100644
--- a/src/libventi/file.c
+++ b/src/libventi/file.c
@@ -98,6 +98,9 @@ vtfilealloc(VtCache *c, VtBlock *b, VtFile *p, u32int offset, int mode)
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;
}