libdlog: fix reconstruction after destruction 40/195340/1
authorMichal Bloch <m.bloch@samsung.com>
Mon, 10 Dec 2018 10:59:59 +0000 (11:59 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Wed, 12 Dec 2018 18:50:01 +0000 (19:50 +0100)
Change-Id: Ib3409ce958d6c936f9a44e337bbec50d36117d02
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/libdlog/log.c

index cb1dcbd..7c93a1a 100644 (file)
@@ -181,10 +181,9 @@ failure:
  * @brief DLog init
  * @details Initializes the library
  */
+static bool is_initialized = false;
 static inline void __dlog_init(void)
 {
-       static int is_initialized = 0;
-
        if (is_initialized)
                return;
 
@@ -192,7 +191,7 @@ static inline void __dlog_init(void)
 
        if (!is_initialized) {
                __configure();
-               is_initialized = 1;
+               is_initialized = true;
        }
 
        pthread_mutex_unlock(&log_init_lock);
@@ -355,4 +354,6 @@ void __attribute__((destructor)) __dlog_fini(void)
 {
        __log_limiter_destroy();
        __dynamic_config_destroy();
+       write_to_log = __write_to_log_null;
+       is_initialized = false;
 }