diff options
Diffstat (limited to 'lib/libncp/sap.c')
-rw-r--r-- | lib/libncp/sap.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libncp/sap.c b/lib/libncp/sap.c index 32e0ab2..78531ab 100644 --- a/lib/libncp/sap.c +++ b/lib/libncp/sap.c @@ -280,12 +280,12 @@ sap_find_nearest(int server_type, struct sockaddr_ipx *daddr, char *server_name) packets = 5; do { len = sap_recv(sock, data, sizeof(data), 0, 1); - if (len < 66) { - packets++; - continue; - } - } while (ntohs(reply->operation) != IPX_SAP_NEAREST_RESPONSE && - packets > 0); + if (len >= 66 && + ntohs(reply->operation) == IPX_SAP_NEAREST_RESPONSE) + break; + if (len < 0) + packets--; + } while (packets > 0); if (packets == 0) { close(sock); |