aboutsummaryrefslogtreecommitdiff
path: root/src/libventi
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-18 20:15:18 +0000
committerrsc <devnull@localhost>2005-01-18 20:15:18 +0000
commit361e279c59273dc82b1a5ced832d790a3b8b7a28 (patch)
tree88800a8bd0bb2c8ca81bd163de87b398f685cd5b /src/libventi
parentaa1d0b1bb0129243f0c4d7c6b3892d8f0556f80a (diff)
downloadplan9port-361e279c59273dc82b1a5ced832d790a3b8b7a28.tar.gz
plan9port-361e279c59273dc82b1a5ced832d790a3b8b7a28.tar.bz2
plan9port-361e279c59273dc82b1a5ced832d790a3b8b7a28.zip
bug fixes
Diffstat (limited to 'src/libventi')
-rw-r--r--src/libventi/client.c5
-rw-r--r--src/libventi/parsescore.c9
-rw-r--r--src/libventi/send.c8
-rw-r--r--src/libventi/srvhello.c4
-rw-r--r--src/libventi/version.c1
5 files changed, 16 insertions, 11 deletions
diff --git a/src/libventi/client.c b/src/libventi/client.c
index b06e0fbe..ddee7cc0 100644
--- a/src/libventi/client.c
+++ b/src/libventi/client.c
@@ -135,9 +135,12 @@ int
vtwrite(VtConn *z, uchar score[VtScoreSize], uint type, uchar *buf, int n)
{
Packet *p;
+ int nn;
p = packetforeign(buf, n, 0, nil);
- return vtwritepacket(z, score, type, p);
+ nn = vtwritepacket(z, score, type, p);
+ packetfree(p);
+ return nn;
}
int
diff --git a/src/libventi/parsescore.c b/src/libventi/parsescore.c
index 2c38808b..bf4a6125 100644
--- a/src/libventi/parsescore.c
+++ b/src/libventi/parsescore.c
@@ -33,8 +33,11 @@ vtparsescore(char *s, char **prefix, uchar score[VtScoreSize])
}
if(colon){
*colon = 0;
- *prefix = s;
- }else
- *prefix = nil;
+ if(prefix)
+ *prefix = s;
+ }else{
+ if(prefix)
+ *prefix = nil;
+ }
return 0;
}
diff --git a/src/libventi/send.c b/src/libventi/send.c
index 3e5f20ea..bcd78507 100644
--- a/src/libventi/send.c
+++ b/src/libventi/send.c
@@ -73,10 +73,10 @@ _vtrecv(VtConn *z)
/* get enough for head size */
size = packetsize(p);
while(size < 2) {
- b = packettrailer(p, MaxFragSize);
+ b = packettrailer(p, 2);
assert(b != nil);
if(0) fprint(2, "%d read hdr\n", getpid());
- n = read(z->infd, b, MaxFragSize);
+ n = read(z->infd, b, 2);
if(0) fprint(2, "%d got %d (%r)\n", getpid(), n);
if(n==0 || (n<0 && !interrupted()))
goto Err;
@@ -90,8 +90,8 @@ _vtrecv(VtConn *z)
size -= 2;
while(size < len) {
- // n = len - size;
- // if(n > MaxFragSize)
+ n = len - size;
+ if(n > MaxFragSize)
n = MaxFragSize;
b = packettrailer(p, n);
if(0) fprint(2, "%d read body %d\n", getpid(), n);
diff --git a/src/libventi/srvhello.c b/src/libventi/srvhello.c
index 029f57bf..0af5a32d 100644
--- a/src/libventi/srvhello.c
+++ b/src/libventi/srvhello.c
@@ -8,10 +8,8 @@ vtsrvhello(VtConn *z)
VtFcall tx, rx;
Packet *p;
- if((p = vtrecv(z)) == nil){
- werrstr("unexpected eof on venti connection");
+ if((p = vtrecv(z)) == nil)
return -1;
- }
if(vtfcallunpack(&tx, p) < 0){
packetfree(p);
diff --git a/src/libventi/version.c b/src/libventi/version.c
index dbbc4dc5..c985910f 100644
--- a/src/libventi/version.c
+++ b/src/libventi/version.c
@@ -101,6 +101,7 @@ Okay:
return 0;
Err:
+ werrstr("vtversion: %r");
if(z->infd >= 0)
close(z->infd);
if(z->outfd >= 0 && z->outfd != z->infd)