diff options
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/dlt-daemon.c | 27 | ||||
-rw-r--r-- | src/daemon/dlt_daemon_unix_socket.c | 6 |
2 files changed, 15 insertions, 18 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c index a8404fd..cdfddec 100644 --- a/src/daemon/dlt-daemon.c +++ b/src/daemon/dlt-daemon.c @@ -1525,7 +1525,7 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, int verbose) { socklen_t cli_size; - struct sockaddr cli; + struct sockaddr_un cli; int in_sock = -1; char local_str[DLT_DAEMON_TEXTBUFSIZE] = { '\0' }; @@ -1542,7 +1542,7 @@ int dlt_daemon_process_client_connect(DltDaemon *daemon, /* event from TCP server socket, new connection */ cli_size = sizeof(cli); - if ((in_sock = accept(receiver->fd, &cli, &cli_size)) < 0) { + if ((in_sock = accept(receiver->fd, (struct sockaddr *)&cli, &cli_size)) < 0) { dlt_vlog(LOG_ERR, "accept() for socket %d failed: %s\n", receiver->fd, strerror(errno)); return -1; } @@ -1794,7 +1794,7 @@ int dlt_daemon_process_control_connect( /* event from UNIX server socket, new connection */ ctrl_size = sizeof(ctrl); - if ((in_sock = accept(receiver->fd, &ctrl, &ctrl_size)) < 0) { + if ((in_sock = accept(receiver->fd, (struct sockaddr *)&ctrl, &ctrl_size)) < 0) { dlt_vlog(LOG_ERR, "accept() on UNIX control socket %d failed: %s\n", receiver->fd, strerror(errno)); return -1; } @@ -1847,7 +1847,7 @@ int dlt_daemon_process_app_connect( /* event from UNIX server socket, new connection */ app_size = sizeof(app); - if ((in_sock = accept(receiver->fd, &app, &app_size)) < 0) { + if ((in_sock = accept(receiver->fd, (struct sockaddr *)&app, &app_size)) < 0) { dlt_vlog(LOG_ERR, "accept() on UNIX socket %d failed: %s\n", receiver->fd, strerror(errno)); return -1; } @@ -3130,7 +3130,6 @@ int create_timer_fd(DltDaemonLocal *daemon_local, DltTimers timer_id) { int local_fd = -1; - struct itimerspec l_timer_spec; char *timer_name = NULL; if (timer_id >= DLT_TIMER_UNKNOWN) { @@ -3145,8 +3144,15 @@ int create_timer_fd(DltDaemonLocal *daemon_local, return -1; } - if (period_sec > 0) { + if (period_sec <= 0 || starts_in <= 0 ) { + /* timer not activated via the service file */ + dlt_vlog(LOG_INFO, "<%s> not set: period=0\n", timer_name); + local_fd = -1; + } #ifdef linux + else + { + struct itimerspec l_timer_spec; local_fd = timerfd_create(CLOCK_MONOTONIC, 0); if (local_fd < 0) { @@ -3172,15 +3178,8 @@ int create_timer_fd(DltDaemonLocal *daemon_local, dlt_log(LOG_WARNING, str); local_fd = -1; } - -#endif - } - else { - /* timer not activated via the service file */ - snprintf(str, sizeof(str), "<%s> not set: period=0\n", timer_name); - dlt_log(LOG_INFO, str); - local_fd = -1; } +#endif /* If fully initialized we are done. * Event handling registration is done later on with other connections. diff --git a/src/daemon/dlt_daemon_unix_socket.c b/src/daemon/dlt_daemon_unix_socket.c index 743035a..e5c5faa 100644 --- a/src/daemon/dlt_daemon_unix_socket.c +++ b/src/daemon/dlt_daemon_unix_socket.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/un.h> #include <sys/socket.h> #include <sys/types.h> @@ -40,8 +41,6 @@ #include "dlt_daemon_socket.h" #include "dlt_daemon_unix_socket.h" -char err_string[DLT_DAEMON_TEXTBUFSIZE]; - int dlt_daemon_unix_socket_open(int *sock, char *sock_path, int type, int mask) { struct sockaddr_un addr; @@ -87,8 +86,7 @@ int dlt_daemon_unix_socket_close(int sock) int ret = close(sock); if (ret != 0) { - sprintf(err_string, "unix socket close failed: %s", strerror(errno)); - dlt_log(LOG_WARNING, err_string); + dlt_vlog(LOG_WARNING, "unix socket close failed: %s", strerror(errno)); } return ret; |