daniel has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/34966?usp=email )


Change subject: logging_gsmtap: Temporarily disable logging when sending the 
logs
......................................................................

logging_gsmtap: Temporarily disable logging when sending the logs

This avoids an infinite recursion when sending a gsmtap log message
causes a log message.
Temporarily set target->loglevel higher than LOGL_FATAL, which
effectively disables logging for that target. Other targets like stderr
will still log this message so there is still an indication that
something went wrong.

Change-Id: I19203cadbad6019a3834793b8ac816d903fe088e
Related: OS#6213
---
M src/core/logging_gsmtap.c
1 file changed, 21 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/66/34966/1

diff --git a/src/core/logging_gsmtap.c b/src/core/logging_gsmtap.c
index dfd059b..1b979ec 100644
--- a/src/core/logging_gsmtap.c
+++ b/src/core/logging_gsmtap.c
@@ -114,7 +114,11 @@
        }
        msgb_put(msg, rc);

+       /* Ensure that any error when sending the log message don't cause 
infinite recursion */
+       level = target->loglevel;
+       target->loglevel = LOGL_FATAL + 1;
        rc = gsmtap_sendmsg(target->tgt_gsmtap.gsmtap_inst, msg);
+       target->loglevel = level;
        if (rc)
                msgb_free(msg);
 }

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34966?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I19203cadbad6019a3834793b8ac816d903fe088e
Gerrit-Change-Number: 34966
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <[email protected]>
Gerrit-MessageType: newchange

Reply via email to