httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@hyperreal.org
Subject cvs commit: apache-2.0/src/main listen.c
Date Sat, 18 Sep 1999 11:48:18 GMT
ben         99/09/18 04:48:17

  Modified:    src/lib/apr/include apr_network_io.h
               src/lib/apr/network_io/unix sockets.c
               src/main listen.c
  Log:
  Make ap_getipaddr threadsafe.
  
  Revision  Changes    Path
  1.6       +1 -1      apache-2.0/src/lib/apr/include/apr_network_io.h
  
  Index: apr_network_io.h
  ===================================================================
  RCS file: /export/home/cvs/apache-2.0/src/lib/apr/include/apr_network_io.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apr_network_io.h	1999/09/14 13:37:21	1.5
  +++ apr_network_io.h	1999/09/18 11:48:14	1.6
  @@ -126,7 +126,7 @@
   ap_status_t ap_setport(ap_socket_t *, ap_uint32_t);
   ap_status_t ap_setipaddr(ap_socket_t *, const char *);
   ap_status_t ap_getport(ap_socket_t *, ap_uint32_t *);
  -ap_status_t ap_getipaddr(ap_socket_t *, char **);
  +ap_status_t ap_getipaddr(char *buf, ap_ssize_t len, const ap_socket_t *sock);
   
   ap_status_t ap_setup_poll(ap_context_t *, ap_int32_t, ap_pollfd_t **);
   ap_status_t ap_poll(ap_pollfd_t *, ap_int32_t *, ap_int32_t);
  
  
  
  1.8       +7 -5      apache-2.0/src/lib/apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /export/home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- sockets.c	1999/09/14 13:37:24	1.7
  +++ sockets.c	1999/09/18 11:48:16	1.8
  @@ -196,15 +196,17 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_getipaddr(ap_socket_t *, char **addr)
  + * ap_status_t ap_getipaddr(char *addr, int len, const ap_socket_t *)
    *    Return the IP address associated with an apr socket.
  - * arg 1) The socket to use 
  - * arg 2) The IP address associated with the socket.
  + * arg 1) A buffer for the IP address associated with the socket.
  + * arg 2) The total length of the buffer (including terminating NUL)
  + * arg 3) The socket to use 
    */
  -ap_status_t ap_getipaddr(struct socket_t *sock, char **addr)
  +ap_status_t ap_getipaddr(char *addr, ap_ssize_t len,
  +			 const struct socket_t *sock)
   {
       char *temp = inet_ntoa(sock->addr->sin_addr);
  -    *addr=temp;
  +    ap_cpystrn(addr,temp,len-1);
       return APR_SUCCESS;
   }
   
  
  
  
  1.8       +2 -2      apache-2.0/src/main/listen.c
  
  Index: listen.c
  ===================================================================
  RCS file: /export/home/cvs/apache-2.0/src/main/listen.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- listen.c	1999/09/08 14:15:43	1.7
  +++ listen.c	1999/09/18 11:48:17	1.8
  @@ -153,13 +153,13 @@
   {
       ap_listen_rec **walk;
       ap_listen_rec *new;
  -    char *oldaddr;
  +    char oldaddr[17];
       unsigned int oldport;
   
       /* see if we've got an old listener for this address:port */
       for (walk = &old_listeners; *walk; walk = &(*walk)->next) {
           ap_getport((*walk)->sd, &oldport);
  -        ap_getipaddr((*walk)->sd, &oldaddr);
  +	ap_getipaddr(oldaddr,sizeof oldaddr,(*walk)->sd);
   	if (!strcmp(oldaddr, addr) && port == oldport) {
   	    /* re-use existing record */
   	    new = *walk;
  
  
  

Mime
View raw message