mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-02 13:03:33 +00:00
mgcp: fix line-break problem in log
When the mgcp_client prints MGCP strings in the log text, it does not remove the line break before printing. This will mess up the log text. This patch removes the line break characters before printing properly. Change-Id: I7fce23a50371ce94a8f2d8aef2fe9d2001d41b8c
This commit is contained in:
committed by
Neels Hofmeyr
parent
3d09bbbbc4
commit
9fa9783dc6
@@ -304,9 +304,16 @@ static int mgcp_do_write(struct osmo_fd *fd, struct msgb *msg)
|
||||
{
|
||||
int ret;
|
||||
static char strbuf[4096];
|
||||
unsigned int l = msg->len < sizeof(strbuf)-1 ? msg->len : sizeof(strbuf)-1;
|
||||
unsigned int l = msg->len < sizeof(strbuf) ? msg->len : sizeof(strbuf);
|
||||
unsigned int i;
|
||||
|
||||
strncpy(strbuf, (const char*)msg->data, l);
|
||||
strbuf[l] = '\0';
|
||||
for (i = 0; i < sizeof(strbuf); i++) {
|
||||
if (strbuf[i] == '\n' || strbuf[i] == '\r') {
|
||||
strbuf[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
DEBUGP(DMGCP, "Tx MGCP msg to MGCP GW: '%s'\n", strbuf);
|
||||
|
||||
LOGP(DMGCP, LOGL_DEBUG, "Sending msg to MGCP GW size: %u\n", msg->len);
|
||||
|
||||
Reference in New Issue
Block a user