From 614ff1dc36b1ad33fd27f0786ff733fcc92abf33 Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Sun, 5 Dec 2010 00:02:29 +0100 Subject: [PATCH] Fix unit test of report slave ID in RTU --- src/modbus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modbus.c b/src/modbus.c index e98b1e1..f43b849 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -344,8 +344,10 @@ static int receive_msg(modbus_t *ctx, int msg_length_computed, /* It's useless to check the value of msg_length_computed in this case (only defined values are used). */ - state = DATA; - break; + if (length_to_read != 0) { + state = DATA; + break; + } /* else switch straight to DATA */ case DATA: length_to_read = compute_data_length(ctx, msg); msg_length_computed += length_to_read; -- libgit2 0.21.4