Ver Fonte

Fix incorrect test of select() return code

Thanks to Thomas Stalder and Torello Querci for the report.
Stéphane Raimbault há 13 anos atrás
pai
commit
30054b90c5
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      src/modbus-tcp.c

+ 1 - 1
src/modbus-tcp.c

@@ -253,7 +253,7 @@ static int _connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen,
         FD_ZERO(&wset);
         FD_SET(sockfd, &wset);
         rc = select(sockfd + 1, NULL, &wset, NULL, tv);
-        if (rc < 0) {
+        if (rc <= 0) {
             /* Timeout or fail */
             return -1;
         }