Skip to content

Commit

Permalink
Use EAI results on Win32 for the moment.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63924 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
wrowe committed Oct 14, 2002
1 parent 4068137 commit 2a98209
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions network_io/unix/sa_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct apr_ipsubnet_t {
#endif
};

#ifndef NETWARE
#if !defined(NETWARE) && !defined(WIN32)
#ifdef HAVE_SET_H_ERRNO
#define SET_H_ERRNO(newval) set_h_errno(newval)
#else
Expand Down Expand Up @@ -336,10 +336,13 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa,
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo(hostname, NULL, &hints, &ai_list);
if (error) {
#ifndef WIN32
if (error == EAI_SYSTEM) {
return errno;
}
else {
else
#endif
{
/* issues with representing this with APR's error scheme:
* glibc uses negative values for these numbers, perhaps so
* they don't conflict with h_errno values... Tru64 uses
Expand Down Expand Up @@ -565,14 +568,9 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname,
if (rc != 0) {
*hostname = NULL;

#ifndef WIN32
/* something went wrong. Look at the EAI_ error code */
if (rc != EAI_SYSTEM) {
#if defined(NEGATIVE_EAI)
if (rc < 0) rc = -rc;
#endif
return rc + APR_OS_START_EAIERR; /* return the EAI_ error */
}
else {
if (rc == EAI_SYSTEM) {
/* EAI_SYSTEM System error returned in errno. */
/* IMHO, Implementations that set h_errno a simply broken. */
if (h_errno) { /* for broken implementations which set h_errno */
Expand All @@ -582,6 +580,14 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname,
return errno + APR_OS_START_SYSERR;
}
}
else
#endif
{
#if defined(NEGATIVE_EAI)
if (rc < 0) rc = -rc;
#endif
return rc + APR_OS_START_EAIERR; /* return the EAI_ error */
}
}
*hostname = sockaddr->hostname = apr_pstrdup(sockaddr->pool,
tmphostname);
Expand Down

0 comments on commit 2a98209

Please sign in to comment.