summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b4a4504)
raw | patch | inline | side by side (parent: b4a4504)
author | Florian Forster <octo@collectd.org> | |
Tue, 6 Sep 2016 08:54:49 +0000 (10:54 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 6 Sep 2016 08:54:49 +0000 (10:54 +0200) |
"struct sockaddr" may be an opaque type.
src/modbus.c | patch | blob | history |
diff --git a/src/modbus.c b/src/modbus.c
index 93fd54a5184f36752fd0fa7365710e3a397a8114..82213d2c6b62ed21c11e035ad7f79a77c935b6e3 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
}
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),
- &sockaddr, &saddrlen);
+ (struct sockaddr *) &(struct sockaddr_storage) { 0 },
+ &(socklen_t) { sizeof (struct sockaddr_storage) });
if (status != 0)
status = errno;
}