From 6088448cdfe3cd152c53136544acc4ee7a508a84 Mon Sep 17 00:00:00 2001 From: Saya Sugiura Date: Wed, 12 Jun 2019 16:18:02 +0900 Subject: Fix alerts from lgtm Signed-off-by: Saya Sugiura --- src/offlinelogstorage/dlt_offline_logstorage_behavior.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/offlinelogstorage') diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c index 2637936..b9dc26c 100644 --- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c +++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c @@ -89,16 +89,17 @@ void dlt_logstorage_log_file_name(char *log_file_name, if (file_config->logfile_timestamp) { char stamp[DLT_OFFLINE_LOGSTORAGE_TIMESTAMP_LEN + 1] = { 0 }; time_t t = time(NULL); - struct tm *tm_info = localtime(&t); + struct tm tm_info; + localtime_r(&t, &tm_info); sprintf(stamp, "%c%04d%02d%02d-%02d%02d%02d", file_config->logfile_delimiter, - 1900 + tm_info->tm_year, - 1 + tm_info->tm_mon, - tm_info->tm_mday, - tm_info->tm_hour, - tm_info->tm_min, - tm_info->tm_sec); + 1900 + tm_info.tm_year, + 1 + tm_info.tm_mon, + tm_info.tm_mday, + tm_info.tm_hour, + tm_info.tm_min, + tm_info.tm_sec); strcat(log_file_name, stamp); } -- cgit v1.2.1