Browse Source

Fix #378981 - CRC error on RTU response doesn't return negative value
Reported by Henrik Munktell.

Stéphane Raimbault 16 years ago
parent
commit
16b9a1b3bf
2 changed files with 9 additions and 7 deletions
  1. 5 3
      NEWS
  2. 4 4
      src/modbus.c

+ 5 - 3
NEWS

@@ -1,4 +1,4 @@
-libmodbus 2.2.0 (2009-05-01)
+libmodbus 2.2.0 (2009-06-01)
 ============================
 - New API for slave server (see MIGRATION)
 - New slave server able to handle multiple connections
@@ -7,10 +7,12 @@ libmodbus 2.2.0 (2009-05-01)
 - modbus_param_t is smaller (2 int removed)
 - Better error management
 - Faster
-- Fix #333455 reported by Jeff Laughlin and Yishin Li.
-  Cygwin IPTOS_LOWDELAY not supported on cygwin
+- Fix #333455 - Cygwin IPTOS_LOWDELAY not supported on cygwin
+  Reported by Jeff Laughlin and Yishin Li.
 - Fix #375926 - modbus.c:164: error: `MSG_DONTWAIT' undeclared
   Reported and tested by Yishin Li.
+- Fix #378981 - CRC error on RTU response doesn't return negative value
+  Reported by Henrik Munktell.
 
 libmodbus 2.0.3 (2009-03-22)
 ============================

+ 4 - 4
src/modbus.c

@@ -639,11 +639,11 @@ static int receive_msg(modbus_param_t *mb_param,
                 printf("\n");
 
         if (mb_param->type_com == RTU) {
-                check_crc16(mb_param, msg, (*p_msg_length));
+                return check_crc16(mb_param, msg, (*p_msg_length));
+        } else {
+                /* OK */
+                return 0;
         }
-
-        /* OK */
-        return 0;
 }
 
 /* Listens for any query from a modbus master in TCP, requires the socket file