diff options
author | rsc <devnull@localhost> | 2004-05-05 04:22:16 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-05-05 04:22:16 +0000 |
commit | 2e965b3324b32be00a2193bf304dcb936f02824b (patch) | |
tree | c183e68a04ee42308f493face299cb4cc4c559ec /src/libventi | |
parent | 4f48d1d4f72b1986ba6df3ccd9db62cfa1ef3df9 (diff) | |
download | plan9port-2e965b3324b32be00a2193bf304dcb936f02824b.tar.gz plan9port-2e965b3324b32be00a2193bf304dcb936f02824b.tar.bz2 plan9port-2e965b3324b32be00a2193bf304dcb936f02824b.zip |
various bug fixes
Diffstat (limited to 'src/libventi')
-rw-r--r-- | src/libventi/rpc.c | 1 | ||||
-rw-r--r-- | src/libventi/srvhello.c | 20 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/libventi/rpc.c b/src/libventi/rpc.c index 915a0243..c6119e45 100644 --- a/src/libventi/rpc.c +++ b/src/libventi/rpc.c @@ -75,6 +75,7 @@ vtrpc(VtConn *z, Packet *p) while(!r->done){ qunlock(&z->lk); if((p = vtrecv(z)) == nil){ + werrstr("unexpected eof on venti connection"); z->muxer = 0; return nil; } diff --git a/src/libventi/srvhello.c b/src/libventi/srvhello.c index 20aedbee..029f57bf 100644 --- a/src/libventi/srvhello.c +++ b/src/libventi/srvhello.c @@ -8,29 +8,31 @@ vtsrvhello(VtConn *z) VtFcall tx, rx; Packet *p; - if((p = vtrecv(z)) == nil) - return 0; + if((p = vtrecv(z)) == nil){ + werrstr("unexpected eof on venti connection"); + return -1; + } if(vtfcallunpack(&tx, p) < 0){ packetfree(p); - return 0; + return -1; } packetfree(p); if(tx.type != VtThello){ vtfcallclear(&tx); werrstr("bad packet type %d; want Thello %d", tx.type, VtThello); - return 0; + return -1; } if(tx.tag != 0){ vtfcallclear(&tx); werrstr("bad tag in hello"); - return 0; + return -1; } if(strcmp(tx.version, z->version) != 0){ vtfcallclear(&tx); werrstr("bad version in hello"); - return 0; + return -1; } vtfree(z->uid); z->uid = tx.uid; @@ -42,9 +44,9 @@ vtsrvhello(VtConn *z) rx.tag = tx.tag; rx.sid = "anonymous"; if((p = vtfcallpack(&rx)) == nil) - return 0; + return -1; if(vtsend(z, p) < 0) - return 0; + return -1; - return 1; + return 0; } |