summaryrefslogtreecommitdiff
path: root/src/daemon/dlt-daemon.c
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/daemon/dlt-daemon.c
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/daemon/dlt-daemon.c')
-rw-r--r--src/daemon/dlt-daemon.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index ee8b929..fd46795 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -253,10 +253,14 @@ int option_file_parser(DltDaemonLocal *daemon_local)
daemon_local->flags.offlineTraceFilenameTimestampBased = 1;
daemon_local->flags.loggingMode = DLT_LOG_TO_CONSOLE;
daemon_local->flags.loggingLevel = LOG_INFO;
- snprintf(daemon_local->flags.loggingFilename,
- sizeof(daemon_local->flags.loggingFilename),
- "%s/dlt.log",
- dltFifoBaseDir);
+
+ if (snprintf(daemon_local->flags.loggingFilename,
+ sizeof(daemon_local->flags.loggingFilename),
+ "%s/dlt.log", dltFifoBaseDir) != 0) {
+ dlt_vlog(LOG_WARNING, "%s: snprintf truncation/error %s\n", __func__,
+ daemon_local->flags.loggingFilename);
+ }
+
daemon_local->timeoutOnSend = 4;
daemon_local->RingbufferMinSize = DLT_DAEMON_RINGBUFFER_MIN_SIZE;
daemon_local->RingbufferMaxSize = DLT_DAEMON_RINGBUFFER_MAX_SIZE;
@@ -1496,7 +1500,9 @@ void dlt_daemon_exit_trigger()
{
char tmp[DLT_PATH_MAX] = { 0 };
- snprintf(tmp, DLT_PATH_MAX, "%s/dlt", dltFifoBaseDir);
+ if (snprintf(tmp, DLT_PATH_MAX, "%s/dlt", dltFifoBaseDir) != 0) {
+ dlt_vlog(LOG_WARNING, "%s: snprintf truncation/error %s\n", __func__, tmp);
+ }
(void)unlink(tmp);
/* stop event loop */
@@ -2346,7 +2352,8 @@ int dlt_daemon_process_user_message_register_application(DltDaemon *daemon,
if (dlt_receiver_check_and_get(rec, description, len, DLT_RCV_NONE) < 0) {
dlt_log(LOG_ERR, "Unable to get application description\n");
/* in case description was not readable, set dummy description */
- strncpy(description, "Unknown", sizeof("Unknown"));
+ memcpy(description, "Unknown", sizeof("Unknown"));
+
/* unknown len of original description, set to 0 to not remove in next
* step. Because message buffer is re-adjusted the corrupted description
* is ignored. */
@@ -2454,7 +2461,8 @@ int dlt_daemon_process_user_message_register_context(DltDaemon *daemon,
if (dlt_receiver_check_and_get(rec, description, len, DLT_RCV_NONE) < 0) {
dlt_log(LOG_ERR, "Unable to get context description\n");
/* in case description was not readable, set dummy description */
- strncpy(description, "Unknown", sizeof("Unknown"));
+ memcpy(description, "Unknown", sizeof("Unknown"));
+
/* unknown len of original description, set to 0 to not remove in next
* step. Because message buffer is re-adjusted the corrupted description
* is ignored. */