From 7486e7a2676b92cd30ee821a378ae274fc58cbb9 Mon Sep 17 00:00:00 2001 From: hadaq Date: Wed, 18 Jul 2012 21:49:17 +0000 Subject: [PATCH] pselect bug fixed, + 1 was missing --- libtrbnet/trbnet.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libtrbnet/trbnet.c b/libtrbnet/trbnet.c index 9e3d106..3a3f2f1 100644 --- a/libtrbnet/trbnet.c +++ b/libtrbnet/trbnet.c @@ -1,11 +1,11 @@ #ifdef ETRAX -const char trbnet_version[] = "$Revision: 4.33 $ Local Etrax"; +const char trbnet_version[] = "$Revision: 4.34 $ Local Etrax"; #elif defined PEXOR -const char trbnet_version[] = "$Revision: 4.33 $ Local Pexor"; +const char trbnet_version[] = "$Revision: 4.34 $ Local Pexor"; #elif defined TRB3 -const char trbnet_version[] = "$Revision: 4.33 $ Local TRB3"; +const char trbnet_version[] = "$Revision: 4.34 $ Local TRB3"; #else -const char trbnet_version[] = "$Revision: 4.33 $ UNKNOWN, i.e. ERROR"; +const char trbnet_version[] = "$Revision: 4.34 $ UNKNOWN, i.e. ERROR"; #endif #include @@ -397,18 +397,18 @@ static int getUDPPackage() if (trb_debug > 2) { fprintf(stderr, "Wait UDP Data\n"); } - + /* Wait for data ready */ - status = pselect(trb3_sockfd, &fds, NULL, NULL, &tv, NULL); + status = pselect(trb3_sockfd + 1, &fds, NULL, NULL, &tv, NULL); if (status == -1) { trb_errno = TRB_TRB3_SOCKET_ERROR; return -1; } - if (status == 0) { + if (FD_ISSET(trb3_sockfd, &fds) == 0) { trb_errno = TRB_TRB3_SOCKET_TIMEOUT; return -1; } - + /* Read Data */ status = recvfrom(trb3_sockfd, (void*)dataBuffer, -- 2.43.0