Don not copy frame data to datagram memory, if datagram type is write-only. stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Fri, 16 Sep 2011 12:44:54 +0200
branchstable-1.5
changeset 2114 b91bb9b96823
parent 2111 d9d56e56f2a2
child 2115 2ec1239216e5
Don not copy frame data to datagram memory, if datagram type is write-only.
master/master.c
--- a/master/master.c	Fri Sep 16 09:19:24 2011 +0200
+++ b/master/master.c	Fri Sep 16 12:44:54 2011 +0200
@@ -1094,8 +1094,14 @@
             continue;
         }
 
-        // copy received data into the datagram memory
-        memcpy(datagram->data, cur_data, data_size);
+        if (datagram->type != EC_DATAGRAM_APWR &&
+                datagram->type != EC_DATAGRAM_FPWR &&
+                datagram->type != EC_DATAGRAM_BWR &&
+                datagram->type != EC_DATAGRAM_LWR) {
+            // copy received data into the datagram memory,
+            // if something has been read
+            memcpy(datagram->data, cur_data, data_size);
+        }
         cur_data += data_size;
 
         // set the datagram's working counter