You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@ibm.net> on 2000/03/13 22:13:56 UTC

1.3 vs. 2.0 in regards to error message for bind failure

1.3:
 
[Mon Mar 13 15:25:16 2000] [crit] (13)Permission denied: make_sock: 
could not bind to port 80

2.0:

[Mon Mar 13 15:10:45 2000] [crit] (13)Permission denied: make_sock:
could not bind to [@main/listen.c:make_sock(): inet_ntoa(server->sin_addr)]

Maybe somebody intended to change the msg string back after ap_get_local_port()
et al were added?

With the patch below, it looks like this:

[Mon Mar 13 15:54:49 2000] [crit] (13)Permission denied: make_sock:
could not bind to address 0.0.0.0 port 80

(1.3 was smart enough to drop "address 0.0.0.0" when binding to
INADDR_ANY, at the cost of more required changes to support IPv6)

Index: listen.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/main/listen.c,v
retrieving revision 1.20
diff -u -r1.20 listen.c
--- listen.c    2000/03/10 00:06:55     1.20
+++ listen.c    2000/03/13 21:12:54
@@ -77,8 +77,13 @@
     int one = 1;
     char addr[512];
     ap_status_t stat;
+    ap_uint32_t port;
+    char *ipaddr;
 
-    ap_cpystrn(addr, "[@main/listen.c:make_sock(): inet_ntoa(server->sin_addr)]", sizeof addr);
+    ap_get_local_port(&port,s);
+    ap_get_local_ipaddr(&ipaddr,s);
+    ap_snprintf(addr, sizeof(addr), "address %s port %u", ipaddr,
+               (unsigned) port);
 
     stat = ap_setsocketopt(s, APR_SO_REUSEADDR, one);
     if (stat != APR_SUCCESS && stat != APR_ENOTIMPL) {

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...