cvs: php-src /main network.c
| From: | Wez Furlong | Date: | Wed, 28 Jul 2004 23:30:23 +0000 |
| Subject: | cvs: php-src /main network.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-28042@lists.php.net to get a copy of this message | ||
wez Wed Jul 28 19:30:23 2004 EDT
Modified files:
/php-src/main network.c
Log:
Ensure that port numbers get set in the peer/socket name functions.
(duh!)
http://cvs.php.net/diff.php/php-src/main/network.c?r1=1.110&r2=1.111&ty=u
Index: php-src/main/network.c
diff -u php-src/main/network.c:1.110 php-src/main/network.c:1.111
--- php-src/main/network.c:1.110 Wed Jul 28 19:15:25 2004
+++ php-src/main/network.c Wed Jul 28 19:30:23 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: network.c,v 1.110 2004/07/28 23:15:25 wez Exp $ */
+/* $Id: network.c,v 1.111 2004/07/28 23:30:23 wez Exp $ */
/*#define DEBUG_MAIN_NETWORK 1*/
@@ -501,7 +501,7 @@
addr++;
} else {
colon = memchr(addr, ':', addrlen);
- if (!colon || colon[1] != ':') {
+ if (!colon) {
return FAILURE;
}
port = atoi(colon + 1);
@@ -592,8 +592,8 @@
/* generally not thread safe, but it *is* thread safe under win32 */
buf = inet_ntoa(((struct sockaddr_in*)sa)->sin_addr);
if (buf) {
- *textaddrlen = strlen(buf);
- *textaddr = estrndup(buf, *textaddrlen);
+ *textaddrlen = spprintf(textaddr, 0, "%s:%d",
+ buf, ntohs(((struct sockaddr_in*)sa)->sin_port));
}
break;
@@ -602,8 +602,8 @@
case AF_INET6:
buf = (char*)inet_ntop(sa->sa_family, &((struct sockaddr_in6*)sa)->sin6_addr, (char
*)&abuf, sizeof(abuf));
if (buf) {
- *textaddrlen = strlen(buf);
- *textaddr = estrndup(buf, *textaddrlen);
+ *textaddrlen = spprintf(textaddr, 0, "%s:%d",
+ buf, ntohs(((struct sockaddr_in6*)sa)->sin6_port));
}
break;