summaryrefslogtreecommitdiff
path: root/src/system/dlt-system-syslog.c
diff options
context:
space:
mode:
authorSimon Herkenhoff <sherkenhoff@jp.adit-jv.com>2018-10-10 10:43:11 +0900
committerSaya Sugiura <ssugiura@jp.adit-jv.com>2019-05-06 15:55:07 +0900
commit40590be05c5eb99f557dfca6f7f6623dcdbe334a (patch)
tree8542563eacb18119b76f2264cc557ab6739031b8 /src/system/dlt-system-syslog.c
parentdf6fc2a1ce9f3a1778e9c8e14c800cd2ad96e96e (diff)
downloadDLT-daemon-40590be05c5eb99f557dfca6f7f6623dcdbe334a.tar.gz
Fix compiler warnings
Fix compiler warnings about socket usage Correct the data types used for the socket declaration. We use AF_UNIX sockets so we use struct sockaddr_un, but we need to cast to struct sockaddr for the socket API. Fix compiler warnings about sign-compare Fix two occurences of signed - unsigned comparison by casting the values accordingly. Note that the cast is legal as the first parts of both conditional statements make sure the value is not negative before casting to unsigned. While at it, add strtol error checking. Fix compiler warnings about string functions Add string.h to src/daemon/dlt_daemon_unix_socket.c, because it was unaware of memcpy and strerror. While at it, change unsafe use of sprintf to proper dlt_vlog and remove the char buffer. Fix compiler warnings about unused-* Fix two unused-variable and one unused-parameter warning. While at it, change the #ifdef to not run into an empty block. Simply reverse the condition and enclose the complete else with the #ifdef. POSIX: Use memset instead of bzero "The bzero() function is deprecated (marked as LEGACY in POSIX.1-2001); use memset(3) in new programs." Use memset instead of bzero and remove any occurrence from DLT. Include of header "strings.h" that has bzero is also removed. Signed-off-by: Simon Herkenhoff <sherkenhoff@jp.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Christoph Lipka <clipka@jp.adit-jv.com>
Diffstat (limited to 'src/system/dlt-system-syslog.c')
-rw-r--r--src/system/dlt-system-syslog.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/system/dlt-system-syslog.c b/src/system/dlt-system-syslog.c
index 8fe9802..3de06fd 100644
--- a/src/system/dlt-system-syslog.c
+++ b/src/system/dlt-system-syslog.c
@@ -50,7 +50,7 @@
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <strings.h>
+#include <string.h>
#include <errno.h>
#include "dlt-system.h"
@@ -89,7 +89,7 @@ int init_socket(SyslogOptions opts)
#endif
syslog_addr.sin_port = htons(opts.Port);
syslog_addr.sin_addr.s_addr = INADDR_ANY;
- bzero(&(syslog_addr.sin_zero), 8);
+ memset(&(syslog_addr.sin_zero), 0, 8);
if (bind(sock, (struct sockaddr *)&syslog_addr,
sizeof(struct sockaddr)) == -1) {