[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
tony2001Mon May 4 14:46:37 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: MFH: use correct function http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.19r2=1.118.2.2.2.20diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.19 php-src/main/network.c:1.118.2.2.2.20 --- php-src/main/network.c:1.118.2.2.2.19 Mon May 4 14:43:14 2009 +++ php-src/main/network.c Mon May 4 14:46:37 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.19 2009/05/04 14:43:14 iliaa Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.20 2009/05/04 14:46:37 tony2001 Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -786,7 +786,7 @@ switch (sa-sa_family) { #if HAVE_GETADDRINFO HAVE_IPV6 case AF_INET6: - if (bindto strstr(bindto, ':')) { + if (bindto strchr(bindto, ':')) { ((struct sockaddr_in6 *)sa)-sin6_family = sa-sa_family; ((struct sockaddr_in6 *)sa)-sin6_port = htons(port); socklen = sizeof(struct sockaddr_in6); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
iliaa Mon May 4 14:43:14 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: Fixed a possible crash http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.18r2=1.118.2.2.2.19diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.18 php-src/main/network.c:1.118.2.2.2.19 --- php-src/main/network.c:1.118.2.2.2.18 Mon May 4 14:12:23 2009 +++ php-src/main/network.c Mon May 4 14:43:14 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.18 2009/05/04 14:12:23 iliaa Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.19 2009/05/04 14:43:14 iliaa Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -786,7 +786,7 @@ switch (sa-sa_family) { #if HAVE_GETADDRINFO HAVE_IPV6 case AF_INET6: - if (strstr(bindto, ':')) { + if (bindto strstr(bindto, ':')) { ((struct sockaddr_in6 *)sa)-sin6_family = sa-sa_family; ((struct sockaddr_in6 *)sa)-sin6_port = htons(port); socklen = sizeof(struct sockaddr_in6); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
iliaa Mon May 4 14:12:23 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: Fixed bad merge http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.17r2=1.118.2.2.2.18diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.17 php-src/main/network.c:1.118.2.2.2.18 --- php-src/main/network.c:1.118.2.2.2.17 Mon May 4 13:12:35 2009 +++ php-src/main/network.c Mon May 4 14:12:23 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.17 2009/05/04 13:12:35 iliaa Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.18 2009/05/04 14:12:23 iliaa Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -423,14 +423,9 @@ switch (sa-sa_family) { #if HAVE_GETADDRINFO HAVE_IPV6 case AF_INET6: - if (strstr(bindto, ':')) { - ((struct sockaddr_in6 *)sa)-sin6_family = sa-sa_family; - ((struct sockaddr_in6 *)sa)-sin6_port = htons(port); - socklen = sizeof(struct sockaddr_in6); - } else { - socklen = 0; - sa = NULL; - } + ((struct sockaddr_in6 *)sa)-sin6_family = sa-sa_family; + ((struct sockaddr_in6 *)sa)-sin6_port = htons(port); + socklen = sizeof(struct sockaddr_in6); break; #endif case AF_INET: -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
felipe Fri Jan 2 21:29:05 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: - MFH: Working with unintialized errno (#46917, noticed by Jost Boekemeier) http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.13r2=1.118.2.2.2.14diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.13 php-src/main/network.c:1.118.2.2.2.14 --- php-src/main/network.c:1.118.2.2.2.13 Wed Dec 31 11:17:47 2008 +++ php-src/main/network.c Fri Jan 2 21:29:04 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.13 2008/12/31 11:17:47 sebastian Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.14 2009/01/02 21:29:04 felipe Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -1141,6 +1141,7 @@ tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout - (tv.tv_sec * 1000)) * 1000; } + errno = 0; n = select(max_fd + 1, rset, wset, eset, timeout = 0 ? tv : NULL); if (n = 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
felipe Fri Jan 2 21:43:07 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: - MFH: Errr, rule nº 1: be portable :) http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.14r2=1.118.2.2.2.15diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.14 php-src/main/network.c:1.118.2.2.2.15 --- php-src/main/network.c:1.118.2.2.2.14 Fri Jan 2 21:29:04 2009 +++ php-src/main/network.c Fri Jan 2 21:43:07 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.14 2009/01/02 21:29:04 felipe Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.15 2009/01/02 21:43:07 felipe Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -1141,7 +1141,9 @@ tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout - (tv.tv_sec * 1000)) * 1000; } +#ifndef PHP_WIN32 errno = 0; +#endif n = select(max_fd + 1, rset, wset, eset, timeout = 0 ? tv : NULL); if (n = 0) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
lbarnaudTue Nov 4 20:41:37 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: MFH: initialize memory http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.11r2=1.118.2.2.2.12diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.11 php-src/main/network.c:1.118.2.2.2.12 --- php-src/main/network.c:1.118.2.2.2.11 Fri Oct 24 10:46:05 2008 +++ php-src/main/network.c Tue Nov 4 20:41:37 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.11 2008/10/24 10:46:05 felipe Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.12 2008/11/04 20:41:37 lbarnaud Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -641,6 +641,7 @@ { php_sockaddr_storage sa; socklen_t sl = sizeof(sa); + memset(sa, 0, sizeof(sa)); if (getpeername(sock, (struct sockaddr*)sa, sl) == 0) { php_network_populate_name_from_sockaddr((struct sockaddr*)sa, sl, @@ -660,6 +661,7 @@ { php_sockaddr_storage sa; socklen_t sl = sizeof(sa); + memset(sa, 0, sizeof(sa)); if (getsockname(sock, (struct sockaddr*)sa, sl) == 0) { php_network_populate_name_from_sockaddr((struct sockaddr*)sa, sl, -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
tony2001Tue Mar 11 10:27:23 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: MFH: fix segfault - error_string may be NULL, in this case we have to follow the old behavior http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.8r2=1.118.2.2.2.9diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.8 php-src/main/network.c:1.118.2.2.2.9 --- php-src/main/network.c:1.118.2.2.2.8Mon Mar 10 20:09:22 2008 +++ php-src/main/network.c Tue Mar 11 10:27:23 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.8 2008/03/10 20:09:22 andrey Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.9 2008/03/11 10:27:23 tony2001 Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -200,12 +200,20 @@ # endif if ((n = getaddrinfo(host, NULL, hints, res))) { - spprintf(error_string, 0, php_network_getaddresses: getaddrinfo failed: %s, PHP_GAI_STRERROR(n)); - php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); + if (error_string) { + spprintf(error_string, 0, php_network_getaddresses: getaddrinfo failed: %s, PHP_GAI_STRERROR(n)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, php_network_getaddresses: getaddrinfo failed: %s, PHP_GAI_STRERROR(n)); + } return 0; } else if (res == NULL) { - spprintf(error_string, 0, php_network_getaddresses: getaddrinfo failed (null result pointer) errno=%d, errno); - php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); + if (error_string) { + spprintf(error_string, 0, php_network_getaddresses: getaddrinfo failed (null result pointer) errno=%d, errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, php_network_getaddresses: getaddrinfo failed (null result pointer)); + } return 0; } @@ -229,8 +237,12 @@ /* XXX NOT THREAD SAFE (is safe under win32) */ host_info = gethostbyname(host); if (host_info == NULL) { - spprintf(error_string, 0, php_network_getaddresses: gethostbyname failed. errno=%d, errno); - php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); + if (error_string) { + spprintf(error_string, 0, php_network_getaddresses: gethostbyname failed. errno=%d, errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, php_network_getaddresses: gethostbyname failed); + } return 0; } in = *((struct in_addr *) host_info-h_addr); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c /main/streams xp_socket.c
andrey Mon Mar 10 20:09:23 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c /php-src/main/streams xp_socket.c Log: char **error_string was passed but not used. This causes problems in cases of getaddrinfo() failure, because the upper layers don't get the error. initialize a variable because we were reading initialized in case of error. http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.7r2=1.118.2.2.2.8diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.7 php-src/main/network.c:1.118.2.2.2.8 --- php-src/main/network.c:1.118.2.2.2.7Mon Dec 31 07:20:15 2007 +++ php-src/main/network.c Mon Mar 10 20:09:22 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.7 2007/12/31 07:20:15 sebastian Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.8 2008/03/10 20:09:22 andrey Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -200,10 +200,12 @@ # endif if ((n = getaddrinfo(host, NULL, hints, res))) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, php_network_getaddresses: getaddrinfo failed: %s, PHP_GAI_STRERROR(n)); + spprintf(error_string, 0, php_network_getaddresses: getaddrinfo failed: %s, PHP_GAI_STRERROR(n)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); return 0; } else if (res == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, php_network_getaddresses: getaddrinfo failed (null result pointer)); + spprintf(error_string, 0, php_network_getaddresses: getaddrinfo failed (null result pointer) errno=%d, errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); return 0; } @@ -227,7 +229,8 @@ /* XXX NOT THREAD SAFE (is safe under win32) */ host_info = gethostbyname(host); if (host_info == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, php_network_getaddresses: gethostbyname failed); + spprintf(error_string, 0, php_network_getaddresses: gethostbyname failed. errno=%d, errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, *error_string); return 0; } in = *((struct in_addr *) host_info-h_addr); http://cvs.php.net/viewvc.cgi/php-src/main/streams/xp_socket.c?r1=1.33.2.2.2.8r2=1.33.2.2.2.9diff_format=u Index: php-src/main/streams/xp_socket.c diff -u php-src/main/streams/xp_socket.c:1.33.2.2.2.8 php-src/main/streams/xp_socket.c:1.33.2.2.2.9 --- php-src/main/streams/xp_socket.c:1.33.2.2.2.8 Wed Feb 27 00:32:39 2008 +++ php-src/main/streams/xp_socket.cMon Mar 10 20:09:22 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: xp_socket.c,v 1.33.2.2.2.8 2008/02/27 00:32:39 iliaa Exp $ */ +/* $Id: xp_socket.c,v 1.33.2.2.2.9 2008/03/10 20:09:22 andrey Exp $ */ #include php.h #include ext/standard/file.h @@ -601,7 +601,7 @@ { char *host = NULL, *bindto = NULL; int portno, bindport = 0; - int err; + int err = 0; int ret; zval **tmpzval = NULL; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
janiWed Jul 18 09:04:58 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: MFH: Use correct macro name http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.5r2=1.118.2.2.2.6diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.5 php-src/main/network.c:1.118.2.2.2.6 --- php-src/main/network.c:1.118.2.2.2.5Tue Jul 17 13:29:33 2007 +++ php-src/main/network.c Wed Jul 18 09:04:58 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.5 2007/07/17 13:29:33 jani Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.6 2007/07/18 09:04:58 jani Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -1035,7 +1035,7 @@ flags = !block; if (ioctlsocket(socketd, FIONBIO, flags) == SOCKET_ERROR) { php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, WSAGetLastError()); - ret = FALSE; + ret = FAILURE; } #else flags = fcntl(socketd, F_GETFL); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
janiTue Jul 17 13:29:33 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: MFH: ws fix http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.4r2=1.118.2.2.2.5diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.4 php-src/main/network.c:1.118.2.2.2.5 --- php-src/main/network.c:1.118.2.2.2.4Thu Jan 11 15:51:37 2007 +++ php-src/main/network.c Tue Jul 17 13:29:33 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.4 2007/01/11 15:51:37 tony2001 Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.5 2007/07/17 13:29:33 jani Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -1026,32 +1026,32 @@ PHPAPI int php_set_sock_blocking(int socketd, int block TSRMLS_DC) { - int ret = SUCCESS; - int flags; - int myflag = 0; + int ret = SUCCESS; + int flags; + int myflag = 0; #ifdef PHP_WIN32 - /* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */ - flags = !block; - if (ioctlsocket(socketd, FIONBIO, flags)==SOCKET_ERROR){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, WSAGetLastError()); - ret = FALSE; - } + /* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */ + flags = !block; + if (ioctlsocket(socketd, FIONBIO, flags) == SOCKET_ERROR) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, WSAGetLastError()); + ret = FALSE; + } #else - flags = fcntl(socketd, F_GETFL); + flags = fcntl(socketd, F_GETFL); #ifdef O_NONBLOCK - myflag = O_NONBLOCK; /* POSIX version */ + myflag = O_NONBLOCK; /* POSIX version */ #elif defined(O_NDELAY) - myflag = O_NDELAY; /* old non-POSIX version */ + myflag = O_NDELAY; /* old non-POSIX version */ #endif - if (!block) { - flags |= myflag; - } else { + if (!block) { + flags |= myflag; + } else { flags = ~myflag; - } - fcntl(socketd, F_SETFL, flags); + } + fcntl(socketd, F_SETFL, flags); #endif - return ret; + return ret; } PHPAPI void _php_emit_fd_setsize_warning(int max_fd) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
tony2001Thu Jan 11 15:51:37 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: MFH http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.3r2=1.118.2.2.2.4diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.3 php-src/main/network.c:1.118.2.2.2.4 --- php-src/main/network.c:1.118.2.2.2.3Mon Jan 1 09:36:11 2007 +++ php-src/main/network.c Thu Jan 11 15:51:37 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.3 2007/01/01 09:36:11 sebastian Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.4 2007/01/11 15:51:37 tony2001 Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -441,7 +441,7 @@ err = php_socket_errno(); } - close(sock); + closesocket(sock); } sock = -1; @@ -870,7 +870,7 @@ #endif } - close(sock); + closesocket(sock); } sock = -1; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /main network.c
pollita Mon Sep 11 19:18:07 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/main network.c Log: MFH: Bug #38687 - sockaddr local storage insufficient for all sock families http://cvs.php.net/viewvc.cgi/php-src/main/network.c?r1=1.118.2.2.2.1r2=1.118.2.2.2.2diff_format=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.118.2.2.2.1 php-src/main/network.c:1.118.2.2.2.2 --- php-src/main/network.c:1.118.2.2.2.1Sat Jul 1 11:35:34 2006 +++ php-src/main/network.c Mon Sep 11 19:18:07 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: network.c,v 1.118.2.2.2.1 2006/07/01 11:35:34 nlopess Exp $ */ +/* $Id: network.c,v 1.118.2.2.2.2 2006/09/11 19:18:07 pollita Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -787,37 +787,46 @@ /* make a connection attempt */ if (bindto) { - struct sockaddr local_address; + struct sockaddr *local_address = NULL; + int local_address_len = 0; if (sa-sa_family == AF_INET) { - struct sockaddr_in *in4 = (struct sockaddr_in*)local_address; + struct sockaddr_in *in4 = emalloc(sizeof(struct sockaddr_in)); + + local_address = (struct sockaddr*)in4; + local_address_len = sizeof(struct sockaddr_in); in4-sin_family = sa-sa_family; in4-sin_port = htons(bindport); if (!inet_aton(bindto, in4-sin_addr)) { - goto bad_ip; + php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid IP Address: %s, bindto); + goto skip_bind; } memset((in4-sin_zero), 0, sizeof(in4-sin_zero)); } #if HAVE_IPV6 HAVE_INET_PTON else { /* IPV6 */ - struct sockaddr_in6 *in6 = (struct sockaddr_in6*)local_address; + struct sockaddr_in6 *in6 = emalloc(sizeof(struct sockaddr_in6)); + + local_address = (struct sockaddr*)in6; + local_address_len = sizeof(struct sockaddr_in6); in6-sin6_family = sa-sa_family; in6-sin6_port = htons(bindport); if (inet_pton(AF_INET6, bindto, in6-sin6_addr) 1) { - goto bad_ip; + php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid IP Address: %s, bindto); + goto skip_bind; } } #endif - if (bind(sock, local_address, sizeof(struct sockaddr))) { + if (!local_address || bind(sock, local_address, local_address_len)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, failed to bind to '%s:%d', system said: %s, bindto, bindport, strerror(errno)); } - goto bind_done; -bad_ip: - php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid IP Address: %s, bindto); +skip_bind: + if (local_address) { + efree(local_address); + } } -bind_done: /* free error string recieved during previous iteration (if any) */ if (error_string *error_string) { efree(*error_string); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php