httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/include apr_errno.h
Date Mon, 03 Apr 2000 03:35:01 GMT
trawick     00/04/02 20:35:00

  Modified:    src/lib/apr/network_io/unix sockopt.c sockets.c networkio.h
               src/lib/apr/include apr_errno.h
  Log:
  Don't use the values of resolver error codes for the
  corresponding APR error codes.  On Unix, return the proper
  APR error code after a resolver error.
  
  Revision  Changes    Path
  1.18      +28 -2     apache-2.0/src/lib/apr/network_io/unix/sockopt.c
  
  Index: sockopt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockopt.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- sockopt.c	2000/03/31 08:36:14	1.17
  +++ sockopt.c	2000/04/03 03:34:59	1.18
  @@ -207,8 +207,34 @@
           return APR_ENOMEM;
       }
   
  -    /* XXX - Is this threadsafe? */
  -    return h_errno;
  +    /* XXX - Is referencing h_errno threadsafe? */
  +    return status_from_res_error(h_errno);
   }
   
  +ap_status_t status_from_res_error(int herr)
  +{
  +    ap_status_t status;
  +    switch(herr) {
  +    case HOST_NOT_FOUND:
  +        status = APR_EHOSTNOTFOUND;
  +        break;
  +    case TRY_AGAIN:
  +        status = APR_EAGAIN;
  +        break;
  +    case NO_RECOVERY:
  +        status = APR_ENORECOVERY;
  +        break;
  +    case NO_ADDRESS:
  +        status = APR_ENOADDRESS;
  +        break;
  +#if defined(NO_DATA) && (NO_ADDRESS != NO_DATA)
  +    case NO_DATA:
  +#endif
  +        status = APR_ENODATA;
  +        break;
  +    default:
  +        status = APR_ENORECOVERY;
  +    }
  +    return status;
  +}
   
  
  
  
  1.32      +1 -4      apache-2.0/src/lib/apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- sockets.c	2000/03/31 08:36:14	1.31
  +++ sockets.c	2000/04/03 03:34:59	1.32
  @@ -231,10 +231,7 @@
               return APR_ENOTSOCK;
           }
           if (!hp)  {
  -            if (h_errno == TRY_AGAIN) {
  -                return EAGAIN;
  -            }
  -            return h_errno;
  +            return status_from_res_error(h_errno);
           }
       
           memcpy((char *)&sock->remote_addr->sin_addr, hp->h_addr_list[0], hp->h_length);
  
  
  
  1.18      +2 -0      apache-2.0/src/lib/apr/network_io/unix/networkio.h
  
  Index: networkio.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/networkio.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- networkio.h	2000/03/31 08:36:14	1.17
  +++ networkio.h	2000/04/03 03:34:59	1.18
  @@ -136,5 +136,7 @@
   ap_int16_t get_event(ap_int16_t);
   ap_int16_t get_revent(ap_int16_t);
   
  +ap_status_t status_from_res_error(int);
  +
   #endif  /* ! NETWORK_IO_H */
   
  
  
  
  1.17      +7 -16     apache-2.0/src/lib/apr/include/apr_errno.h
  
  Index: apr_errno.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_errno.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- apr_errno.h	2000/03/31 08:35:55	1.16
  +++ apr_errno.h	2000/04/03 03:35:00	1.17
  @@ -366,29 +366,20 @@
   #define APR_EOPNOTSUPP (APR_OS_START_SYSERR + 35)
   #endif
   
  -#ifdef HOST_NOT_FOUND
  -#define APR_EHOSTNOTFOUND HOST_NOT_FOUND
  -#else
  +/* never use h_errno values as-is because doing so makes them 
  + * indistinguishable from errno values
  + * APR_EHOSTNOTFOUND corresponds to HOST_NOT_FOUND
  + * APR_ENODATA corresponds to NO_DATA
  + * APR_ENOADDRESS corresponds to NO_ADDRESS
  + * APR_ENORECOVERY corresponds to NO_RECOVERY
  + */
   #define APR_EHOSTNOTFOUND (APR_OS_START_SYSERR + 36)
  -#endif
   
  -#ifdef NO_DATA
  -#define APR_ENODATA NO_DATA
  -#else
   #define APR_ENODATA (APR_OS_START_SYSERR + 37)
  -#endif
   
  -#ifdef NO_ADDRESS
  -#define APR_ENOADDRESS NO_ADDRESS
  -#else
   #define APR_ENOADDRESS (APR_OS_START_SYSERR + 38)
  -#endif
   
  -#ifdef NO_RECOVERY
  -#define APR_ENORECOVERY NO_RECOVERY
  -#else
   #define APR_ENORECOVERY (APR_OS_START_SYSERR + 39)
  -#endif
   
   #ifdef EISCONN
   #define APR_EISCONN EISCONN
  
  
  

Mime
View raw message