Merge branch 'collectd-5.6'
[collectd.git] / src / modbus.c
index a7d1b58..589ce90 100644 (file)
 #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 */
@@ -472,10 +473,9 @@ static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */
   {
     /* getpeername() is used only to determine if the socket is connected, not
      * because we're really interested in the peer's IP address. */
-    status = getpeername (modbus_get_socket (host->connection),
-        (struct sockaddr *) &(struct sockaddr_storage) { 0 },
-        &(socklen_t) { sizeof (struct sockaddr_storage) });
-    if (status != 0)
+    if (getpeername (modbus_get_socket (host->connection),
+          (void *) &(struct sockaddr_storage) {0},
+          &(socklen_t) {sizeof(struct sockaddr_storage)}) != 0)
       status = errno;
   }