You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Günter Knauf <ef...@gmx.net> on 2004/02/02 18:29:26 UTC

Re: [PATCH] ./native2/common/jk_channel_apr_socket.c - use apr_port_t instead of short for port

Hi Henri,
>> Do you know what's about the ./native2/common/jk_channel_socket.c file?
>> Does soemone still use it since APR is now mandatory, or can we remove
>> it?
>>If it stays then we should also patch the port there to 'unsigned
>>short'...

> Yes, it should be removed but the conservative approach will be to
> have a patch for unsigned short
here we go:
http://www.gknw.com/test/jk_channel_socket.c.diff
========================================================================
# Patch to solve http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17579
#
--- ./jk/native2/common/jk_channel_socket.c.origThu Jan 29 18:23:28 2004
+++ ./jk/native2/common/jk_channel_socket.cMon Feb 02 18:19:28 2004
@@ -100,7 +100,7 @@
     int ndelay;
     struct sockaddr_in addr;    
     char *host;
-    short port; /* Should be unsigned - big ports will fail */
+    unsigned short port;
     int keepalive;
     int timeout;
 };
@@ -116,7 +116,7 @@
 */
 
 static int JK_METHOD jk2_channel_socket_resolve(jk_env_t *env, char *host,
-                                               short port,
+                                               unsigned short port,
                                                struct sockaddr_in *rc);
 
 static int JK_METHOD jk2_channel_socket_close(jk_env_t *env, jk_channel_t *ch,
@@ -276,7 +276,8 @@
 
 /** private: resolve the address on init
  */
-static int JK_METHOD jk2_channel_socket_resolve(jk_env_t *env, char *host, short port,
+static int JK_METHOD jk2_channel_socket_resolve(jk_env_t *env, char *host, 
+                                               unsigned short port,
                                                struct sockaddr_in *rc)
 {
     int x;
@@ -285,7 +286,7 @@
     /* for now use the correct type, in_addr_t   */    
 in_addr_t laddr;
     
-    rc->sin_port   = htons((short)port);
+    rc->sin_port   = htons((unsigned short)port);
     rc->sin_family = AF_INET;
 
     /* Check if we only have digits in the string */

Guenter.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org