瀏覽代碼

Fix incorrect test of select() return code

Thanks to Thomas Stalder and Torello Querci for the report.
Stéphane Raimbault 13 年之前
父節點
當前提交
30054b90c5
共有 1 個文件被更改,包括 1 次插入1 次删除
  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;
         }