diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-10-29 10:37:44 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-10-29 09:45:21 +0000 |
commit | 16f989ef91a89a79bfd5a1512e98f3f56f93ad6c (patch) | |
tree | 71a7c66c91dc30d663cd8ff37608995e782bd2fc | |
parent | 229fa070c49cb78c10dfda9e813b3702d9bf6e47 (diff) |
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
-rw-r--r-- | src/application.c | 6 |
1 files changed, 6 insertions, 0 deletions
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) |