laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/36324?usp=email )
Change subject: msgb: Also copy msgb {dst, lchan, cb} during msgb_copy_* ......................................................................
msgb: Also copy msgb {dst, lchan, cb} during msgb_copy_*
It wasn't really specified if those fields are supposed to be copied. But after all, a copy is supposed to behave exactly like the original, not just in terms of the data but all aspects.
Change-Id: I68328adb952ca8833ba047cb3b49ccc6f8a1f1b5 --- M src/core/msgb.c 1 file changed, 18 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/24/36324/1
diff --git a/src/core/msgb.c b/src/core/msgb.c index 713510c..b79dc32 100644 --- a/src/core/msgb.c +++ b/src/core/msgb.c @@ -356,6 +356,11 @@ if (msg->l4h) new_msg->l4h = new_msg->_data + (msg->l4h - msg->_data);
+ /* copy other metadata like cb */ + new_msg->dst = msg->dst; + new_msg->lchan = msg->lchan; + memcpy(new_msg->cb, msg->cb, sizeof(new_msg->cb)); + return new_msg; }