projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Address review comments:
[collectd.git]
/
src
/
modbus.c
diff --git
a/src/modbus.c
b/src/modbus.c
index
93fd54a
..
82213d2
100644
(file)
--- a/
src/modbus.c
+++ b/
src/modbus.c
@@
-470,11
+470,11
@@
static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */
}
else if (host->conntype == MBCONN_TCP)
{
}
else if (host->conntype == MBCONN_TCP)
{
- struct sockaddr sockaddr;
- socklen_t saddrlen = sizeof (sockaddr);
-
+ /* 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),
status = getpeername (modbus_get_socket (host->connection),
- &sockaddr, &saddrlen);
+ (struct sockaddr *) &(struct sockaddr_storage) { 0 },
+ &(socklen_t) { sizeof (struct sockaddr_storage) });
if (status != 0)
status = errno;
}
if (status != 0)
status = errno;
}