apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: cvs commit: apr/network_io/unix sa_common.c
Date Tue, 15 Oct 2002 10:53:44 GMT
wrowe@apache.org writes:

>   Index: sa_common.c
>   ===================================================================
>   RCS file: /home/cvs/apr/network_io/unix/sa_common.c,v
>   retrieving revision 1.64
>   retrieving revision 1.65
>   diff -u -r1.64 -r1.65
>   --- sa_common.c	14 Oct 2002 00:03:46 -0000	1.64
>   +++ sa_common.c	15 Oct 2002 04:10:31 -0000	1.65
>   @@ -474,7 +474,20 @@
>    #ifdef WIN32
>                return apr_get_netos_error();
>    #else
>   -            return (h_errno + APR_OS_START_SYSERR);
>   +            switch (h_errno) {
>   +#ifdef NETDB_INTERNAL
>   +                NETDB_INTERNAL:
>   +                    return APR_FROM_OS_ERROR(errno);

NETDB_INTERNAL is not defined in some places where the others are
defined

>   +                HOST_NOT_FOUND:
>   +                    return APR_EHOSTUNREACH;

-1...   EHOSTUNREACH is not the same as HOST_NOT_FOUND...   this
is making it hard for somebody to know what error code the resolver
actually set...  they have to go dig through the APR source code
instead of extracting HOST_NOT_FOUND from the APR error code

The app should get the real error code set by the resolver, encoded
properly so as not to be confused with errno or anything else.
Obviously, if the resolver says to look in errno then errno should be
returned.

>   +                NO_DATA:
>   +                    return APR_E;

even if I didn't want NO_DATA, what is APR_E?

>   +                NO_RECOVERY:
>   +                    return APR_EHOSTUNREACH;

not the same

>   +                TRY_AGAIN:
>   +                    return APR_EAGAIN;

not the same

by the way, two of the h_errno constants often have the same numeric
value and can't be used like this in a switch()...

>   +            }
>   +            /* return (h_errno + APR_OS_START_SYSERR); */

what gets returned if the switch() didn't find a match?

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Mime
View raw message