瀏覽代碼

Fix #274511 reported by 'Kylesch'
Invalid error check in modbus_init_listen_tcp

Stéphane Raimbault 16 年之前
父節點
當前提交
5c98a1bf0b
共有 2 個文件被更改,包括 7 次插入2 次删除
  1. 6 1
      NEWS
  2. 1 1
      modbus/modbus.c

+ 6 - 1
NEWS

@@ -1,4 +1,9 @@
-libmodbus 2.0.2 (2008-08-XX)
+libmodbus 2.0.3 (2008-XX-XX)
+============================
+- Fix #274511 reported by 'Kylesch'
+  Invalid error check in modbus_init_listen_tcp
+
+libmodbus 2.0.2 (2008-08-10)
 ============================
 - Fix a bug reported by email by Davide Pippa
   The function modbus_receive must check the number of values

+ 1 - 1
modbus/modbus.c

@@ -1827,7 +1827,7 @@ int modbus_init_listen_tcp(modbus_param_t *mb_param)
 
         addrlen = sizeof(struct sockaddr_in);
         mb_param->fd = accept(new_socket, (struct sockaddr *)&addr, &addrlen);
-        if (ret < 0) {
+        if (mb_param->fd < 0) {
                 perror("accept");
                 close(new_socket);
                 new_socket = 0;