X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodbus.c;h=473a4ee435230a96268eee789ce531ba2c56dbdc;hb=1326af38b3ef25c41c994cd76c043202636b3d70;hp=db7d033d3f1c0be05cb0f5d08623a369390f0d8e;hpb=f0d468892e1c173b226f739be48291981473b4fb;p=collectd.git diff --git a/src/modbus.c b/src/modbus.c index db7d033d..473a4ee4 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -23,12 +23,12 @@ #include "collectd.h" #include "common.h" -#include "plugin.h" #include "configfile.h" - -#include +#include "plugin.h" #include +#include +#include #ifndef LIBMODBUS_VERSION_CHECK /* Assume version 2.0.3 */ @@ -471,12 +471,9 @@ static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */ } 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; }