From 16f989ef91a89a79bfd5a1512e98f3f56f93ad6c Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 29 Oct 2017 10:37:44 +0100 Subject: 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 --- src/application.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/application.c b/src/application.c index ee226391..538ac45d 100644 --- a/src/application.c +++ b/src/application.c @@ -112,6 +112,12 @@ void osmo_init_ignore_signals(void) */ 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) -- cgit v1.2.3