Explorar el Código

Fix incorrect test of select() return code

Thanks to Thomas Stalder and Torello Querci for the report.
Stéphane Raimbault hace 13 años
padre
commit
30054b90c5
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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;
         }