Commit 8ac3d17d authored by Pekka Pessi's avatar Pekka Pessi
Browse files

su_addrinfo.c: if su_getaddrinfo() service is NULL, try both with "0" and NULL

darcs-hash:20080111142846-65a35-abac280d4a10b6b346373f7b2beaaf303478620a.gz
parent 6d69a91f
...@@ -126,7 +126,7 @@ struct addrinfo { ...@@ -126,7 +126,7 @@ struct addrinfo {
#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) #define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
#endif #endif
/** RFC 1576 address info structure. */ /** @RFC1576 address info structure. */
typedef struct addrinfo su_addrinfo_t; typedef struct addrinfo su_addrinfo_t;
/** Translate address and service. */ /** Translate address and service. */
......
...@@ -893,6 +893,7 @@ int su_getaddrinfo(char const *node, char const *service, ...@@ -893,6 +893,7 @@ int su_getaddrinfo(char const *node, char const *service,
{ {
int retval; int retval;
su_addrinfo_t *ai; su_addrinfo_t *ai;
char const *realservice = service;
if (!service || service[0] == '\0') if (!service || service[0] == '\0')
service = "0"; service = "0";
...@@ -932,6 +933,9 @@ int su_getaddrinfo(char const *node, char const *service, ...@@ -932,6 +933,9 @@ int su_getaddrinfo(char const *node, char const *service,
retval = getaddrinfo(node, service, hints, res); retval = getaddrinfo(node, service, hints, res);
if (service != realservice && retval == EAI_SERVICE)
retval = getaddrinfo(node, realservice, hints, res);
if (retval == 0) { if (retval == 0) {
for (ai = *res; ai; ai = ai->ai_next) { for (ai = *res; ai; ai = ai->ai_next) {
if (ai->ai_protocol) if (ai->ai_protocol)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment