hgomez      2002/09/24 15:36:28

  Modified:    jk/native2/common jk_channel_socket.c
  Log:
  AS/400 back port from 1.2.0.
  
  notice here that we should use gethostbyname_r for multi-thread support
  
  Revision  Changes    Path
  1.40      +17 -1     jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c
  
  Index: jk_channel_socket.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_socket.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- jk_channel_socket.c       24 Sep 2002 09:05:50 -0000      1.39
  +++ jk_channel_socket.c       24 Sep 2002 22:36:28 -0000      1.40
  @@ -207,6 +207,10 @@
       int x;
       u_long laddr;
       
  +#ifdef AS400
  +    memset(rc, 0, sizeof(struct sockaddr_in));               
  +#endif
  +
       rc->sin_port   = htons((short)port);
       rc->sin_family = AF_INET;
   
  @@ -218,11 +222,23 @@
       }
   
       if(host[x] != '\0') {
  -        /* If we found also characters we use gethostbyname()*/
  +#ifdef AS400
  +       /* If we found also characters we use gethostbyname_r()*/
  +       struct hostent hostentry;
  +       struct hostent *hoste = &hostentry;
  +       struct hostent_data hd;
  +       memset( &hd, 0, sizeof(struct hostent_data) );
  +       if ( (gethostbyname_r( host, hoste, &hd )) != 0 ) {
  +        return JK_ERR;
  +       }
  +#else /* If we found also characters we use gethostbyname()*/
  +      /* XXX : WARNING : We should really use gethostbyname_r in multi-threaded env 
      */
  +      /* take a look at APR which handle gethostbyname in 
apr/network_io/unix/sa_common.c */
           struct hostent *hoste = gethostbyname(host);
           if(!hoste) {
               return JK_ERR;
           }
  +#endif
   
           laddr = ((struct in_addr *)hoste->h_addr_list[0])->s_addr;
       } else {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to