X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmodbus.c;h=ec429698bda23d1c7ca62c031b3099c809989fb9;hb=71bbf854d3e6f8c6d6c3582527263bb01a3a7e04;hp=809194b4c51538d39a3f25180d8be5df77ebc843;hpb=69b8a9a1af204685dfdfaf1279a0f2928e0bbb32;p=collectd.git diff --git a/src/modbus.c b/src/modbus.c index 809194b4..ec429698 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -818,22 +818,17 @@ static int mb_config_set_host_address (mb_host_t *host, /* {{{ */ { struct addrinfo *ai_list; struct addrinfo *ai_ptr; - struct addrinfo ai_hints = { 0 }; int status; if ((host == NULL) || (address == NULL)) return (EINVAL); -#if AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif - /* XXX: libmodbus can only handle IPv4 addresses. */ - ai_hints.ai_family = AF_INET; - ai_hints.ai_addr = NULL; - ai_hints.ai_canonname = NULL; - ai_hints.ai_next = NULL; + struct addrinfo ai_hints = { + /* XXX: libmodbus can only handle IPv4 addresses. */ + .ai_family = AF_INET, + .ai_flags = AI_ADDRCONFIG + }; - ai_list = NULL; status = getaddrinfo (address, /* service = */ NULL, &ai_hints, &ai_list); if (status != 0)