diff --git a/src/modbus.c b/src/modbus.c
index 93fd54a5184f36752fd0fa7365710e3a397a8114..473a4ee435230a96268eee789ce531ba2c56dbdc 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
#include "collectd.h"
#include "common.h"
+#include "configfile.h"
#include "plugin.h"
-#include <netdb.h>
-
#include <modbus.h>
+#include <netdb.h>
+#include <sys/socket.h>
#ifndef LIBMODBUS_VERSION_CHECK
/* Assume version 2.0.3 */
}
else if (host->conntype == MBCONN_TCP)
{
- struct sockaddr sockaddr;
- socklen_t saddrlen = sizeof (sockaddr);
-
- status = getpeername (modbus_get_socket (host->connection),
- &sockaddr, &saddrlen);
- if (status != 0)
+ if (getpeername (modbus_get_socket (host->connection),
+ (void *) &(struct sockaddr_storage) {0},
+ &(socklen_t) {sizeof(struct sockaddr_storage)}) != 0)
status = errno;
}