summaryrefslogtreecommitdiff
path: root/src/offlinelogstorage
diff options
context:
space:
mode:
authorFelix Herrmann <fherrmann@de.adit-jv.com>2020-01-13 10:40:25 +0100
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2020-07-06 10:04:07 +0900
commit676e8fc1ba927dc84df82b508d796e31d9fd120c (patch)
tree141271d339f1ba68d0b29fd124e8eaa5d3d99fd4 /src/offlinelogstorage
parentec391decd94ac9f6c6133c24a41c8afb2c01623f (diff)
downloadDLT-daemon-676e8fc1ba927dc84df82b508d796e31d9fd120c.tar.gz
fix some gcc9 compiler warnings
Many stringop-truncation and stringop-overflow warnings are still there (so many). https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/ Signed-off-by: Felix Herrmann <fherrmann@de.adit-jv.com> Signed-off-by: KHANH LUONG HONG DUY <khanh.luonghongduy@vn.bosch.com>
Diffstat (limited to 'src/offlinelogstorage')
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage_behavior.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
index d0ea325..7c55a1a 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage_behavior.c
@@ -90,15 +90,19 @@ void dlt_logstorage_log_file_name(char *log_file_name,
struct tm tm_info;
tzset();
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);
+ if (snprintf(stamp,
+ DLT_OFFLINE_LOGSTORAGE_TIMESTAMP_LEN + 1,
+ "%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) != 0) {
+ dlt_vlog(LOG_WARNING, "%s: snprintf truncation %s\n", __func__,
+ stamp);
+ }
strcat(log_file_name, stamp);
}