<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-sip-connector/+/16220">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">logging from sofia: add missing newline<br><br>Sometimes, lgging from sofia lacks the final newline character, messing up log<br>output. First snprintf() to a buffer, add '\n' if necessary and then log.<br><br>Change-Id: Ia26c0b57a0166cf7de87c49471ce6f528a366dd5<br>---<br>M src/sip.c<br>1 file changed, 10 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector refs/changes/20/16220/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/sip.c b/src/sip.c</span><br><span>index 2b28b4e..5eaa94b 100644</span><br><span>--- a/src/sip.c</span><br><span>+++ b/src/sip.c</span><br><span>@@ -666,7 +666,16 @@</span><br><span> * the log handler call-back function, so we have no clue what log level the</span><br><span> * currently logged message was sent for :( As a result, we can only use one</span><br><span> * hard-coded LOGL_NOTICE here */</span><br><span style="color: hsl(0, 100%, 40%);">- osmo_vlogp(DSIP, LOGL_NOTICE, "", 0, 0, fmt, ap);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!log_check_level(DSIP, LOGL_NOTICE))</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* The sofia-sip log line *sometimes* lacks a terminating '\n'. Add it. */</span><br><span style="color: hsl(120, 100%, 40%);">+ char log_line[256];</span><br><span style="color: hsl(120, 100%, 40%);">+ if (vsnprintf(log_line, sizeof(log_line), fmt, ap) > 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ char *end = log_line + OSMO_MIN(strlen(log_line), sizeof(log_line) - 2);</span><br><span style="color: hsl(120, 100%, 40%);">+ osmo_strlcpy(end, "\n", 2);</span><br><span style="color: hsl(120, 100%, 40%);">+ LOGP(DSIP, LOGL_NOTICE, "%s", log_line);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else</span><br><span style="color: hsl(120, 100%, 40%);">+ LOGP(DSIP, LOGL_NOTICE, "unknown logging from sip\n");</span><br><span> }</span><br><span> </span><br><span> void sip_agent_init(struct sip_agent *agent, struct app_config *app)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-sip-connector/+/16220">change 16220</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-sip-connector/+/16220"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: osmo-sip-connector </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ia26c0b57a0166cf7de87c49471ce6f528a366dd5 </div>
<div style="display:none"> Gerrit-Change-Number: 16220 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>