From ddd9009109578d25cced7c894590dea07e3005a0 Mon Sep 17 00:00:00 2001 From: "Robert S. French" Date: Wed, 15 Jun 1988 12:55:05 +0000 Subject: For John --- lib/ZRecvPkt.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'lib/ZRecvPkt.c') diff --git a/lib/ZRecvPkt.c b/lib/ZRecvPkt.c index 33a48c0..03bf070 100644 --- a/lib/ZRecvPkt.c +++ b/lib/ZRecvPkt.c @@ -25,24 +25,17 @@ Code_t ZReceivePacket(buffer, ret_len, from) int *ret_len; struct sockaddr_in *from; { - int retval; + Code_t retval; struct _Z_InputQ *nextq; - if (ZGetFD() < 0) - return (ZERR_NOPORT); - - if (ZQLength()) { - if ((retval = Z_ReadEnqueue()) != ZERR_NONE) - return (retval); - } - else { - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - } + if ((retval = Z_WaitForComplete()) != ZERR_NONE) + return (retval); nextq = (struct _Z_InputQ *) Z_GetFirstComplete(); *ret_len = nextq->packet_len; + if (*ret_len > Z_MAXPKTLEN) + return (ZERR_PKTLEN); bcopy(nextq->packet, buffer, *ret_len); -- cgit v1.2.3