void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t salen,
int flags, ares_nameinfo_callback callback, void *arg)
{
- struct sockaddr_in *addr;
- struct sockaddr_in6 *addr6;
+ struct sockaddr_in *addr = NULL;
+ struct sockaddr_in6 *addr6 = NULL;
struct nameinfo_query *niquery;
/* Verify the buffer size */
char tmpbuf[4096];
if (port)
- {
+ {
if (flags & ARES_NI_NUMERICSERV)
sep = NULL;
else
- {
+ {
if (flags & ARES_NI_UDP)
proto = "udp";
else if (flags & ARES_NI_SCTP)
#elif GETSERVBYPORT_R_ARGS == 4
if (getservbyport_r(port, proto, &se, (void *)tmpbuf) != 0)
sep = NULL;
-#else
+#else
/* Lets just hope the OS uses TLS! */
sep = getservbyport(port, proto);
-#endif
-#else
+#endif
+#else
/* Lets just hope the OS uses TLS! */
sep = getservbyport(port, proto);
-#endif
- }
+#endif
+ }
if (sep && sep->s_name)
/* get service name */
strcpy(tmpbuf, sep->s_name);