Fix for SVACE defects
[platform/core/api/sound-pool.git] / test / logger / src / logger.c
index d3932ab..c36d74b 100644 (file)
@@ -55,7 +55,6 @@ static struct {
        pthread_mutex_t mutex;
        time_t timer;
 } __logger = { 0, LOG_MODE_NONE, {'\0'}, PTHREAD_MUTEX_INITIALIZER, 0 };
-
 static char LOGGER_LOG_TAG[MAX_LOG_TAG_LEN] = LOG_TAG;
 
 #define MAX_DATETIME_STR_LEN 26
@@ -101,10 +100,12 @@ int _logger_set_log_tag(const char *tag)
 
 #   define __LOGGER_PREPARE()                                                  \
                do {                                                                   \
+                       struct tm timenew;                                                 \
                        pthread_mutex_lock(&__logger.mutex);                               \
                        time(&__logger.timer);                                             \
+                       localtime_r(&__logger.timer, &timenew);                            \
                        strftime(str_time, MAX_DATETIME_STR_LEN, "%Y:%m:%d %H:%M:%S",      \
-                                       localtime(&__logger.timer));                               \
+                                        &timenew);                                                \
                } while (0)
 
 #   define __LOGGER_UNPREPARE()                                                \