This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged.
Change subject: Catch repeated calls to osmo_init_logging()
......................................................................
Catch repeated calls to osmo_init_logging()
If an application calls osmo_init_logging() multiple times, let's
bail out in a safe way without corrupting the state + returning an
error.
Change-Id: Icf337a430fb367bbca48a1b02822a2cb3b644e5f
---
M src/application.c
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/application.c b/src/application.c
index ee22639..538ac45 100644
--- a/src/application.c
+++ b/src/application.c
@@ -112,6 +112,12 @@
*/
int osmo_init_logging(const struct log_info *log_info)
{
+ static int logging_initialized = 0;
+
+ if (logging_initialized)
+ return -EEXIST;
+
+ logging_initialized = 1;
log_init(log_info, NULL);
osmo_stderr_target = log_target_create_stderr();
if (!osmo_stderr_target)
--
To view, visit https://gerrit.osmocom.org/4562
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icf337a430fb367bbca48a1b02822a2cb3b644e5f
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder