summaryrefslogtreecommitdiff
path: root/src/shared/dlt_offline_trace.c
diff options
context:
space:
mode:
authorSaya Sugiura <ssugiura@jp.adit-jv.com>2019-06-12 16:18:02 +0900
committerSaya Sugiura <ssugiura@jp.adit-jv.com>2019-06-19 11:00:37 +0900
commit6088448cdfe3cd152c53136544acc4ee7a508a84 (patch)
tree3b8ed06c2502c8d2daae736b6af2e1d9701f50b4 /src/shared/dlt_offline_trace.c
parent3e73652e5dce1e841d959f521727a0952c2d1c92 (diff)
downloadDLT-daemon-6088448cdfe3cd152c53136544acc4ee7a508a84.tar.gz
Fix alerts from lgtm
Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com>
Diffstat (limited to 'src/shared/dlt_offline_trace.c')
-rw-r--r--src/shared/dlt_offline_trace.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/shared/dlt_offline_trace.c b/src/shared/dlt_offline_trace.c
index 76de233..fd59fc0 100644
--- a/src/shared/dlt_offline_trace.c
+++ b/src/shared/dlt_offline_trace.c
@@ -178,7 +178,7 @@ unsigned int dlt_offline_trace_get_idx_of_log_file(char *file)
DltReturnValue dlt_offline_trace_create_new_file(DltOfflineTrace *trace)
{
time_t t;
- struct tm *tmp;
+ struct tm tmp;
char outstr[200];
char newest[DLT_OFFLINETRACE_FILENAME_MAX_SIZE] = { 0 };
char oldest[DLT_OFFLINETRACE_FILENAME_MAX_SIZE] = { 0 };
@@ -188,14 +188,9 @@ DltReturnValue dlt_offline_trace_create_new_file(DltOfflineTrace *trace)
if (trace->filenameTimestampBased) {
int ret = 0;
t = time(NULL);
- tmp = localtime(&t);
+ localtime_r(&t, &tmp);
- if (NULL == tmp) {
- printf("dlt_offline_trace_create_new_file: pointer to tmp is NULL!");
- return DLT_RETURN_ERROR;
- }
-
- if (strftime(outstr, sizeof(outstr), "%Y%m%d_%H%M%S", tmp) == 0) {}
+ strftime(outstr, sizeof(outstr), "%Y%m%d_%H%M%S", &tmp);
ret = snprintf(trace->filename, NAME_MAX, "%s/dlt_offlinetrace_%s.dlt", trace->directory, outstr);