andrey Mon Mar 10 19:54:47 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/main network.c
/php-src/main/streams xp_socket.c
Log:
char **error_message 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.6.2.4&r2=1.118.2.2.2.6.2.5&diff_format=u
Index: php-src/main/network.c
diff -u php-src/main/network.c:1.118.2.2.2.6.2.4
php-src/main/network.c:1.118.2.2.2.6.2.5
--- php-src/main/network.c:1.118.2.2.2.6.2.4 Mon Dec 31 07:17:17 2007
+++ php-src/main/network.c Mon Mar 10 19:54:47 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: network.c,v 1.118.2.2.2.6.2.4 2007/12/31 07:17:17 sebastian Exp $ */
+/* $Id: network.c,v 1.118.2.2.2.6.2.5 2008/03/10 19:54:47 andrey Exp $ */
/*#define DEBUG_MAIN_NETWORK 1*/
@@ -205,10 +205,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;
}
@@ -232,7 +234,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.6.2.2&r2=1.33.2.2.2.6.2.3&diff_format=u
Index: php-src/main/streams/xp_socket.c
diff -u php-src/main/streams/xp_socket.c:1.33.2.2.2.6.2.2
php-src/main/streams/xp_socket.c:1.33.2.2.2.6.2.3
--- php-src/main/streams/xp_socket.c:1.33.2.2.2.6.2.2 Wed Feb 27 00:30:24 2008
+++ php-src/main/streams/xp_socket.c Mon Mar 10 19:54:47 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xp_socket.c,v 1.33.2.2.2.6.2.2 2008/02/27 00:30:24 iliaa Exp $ */
+/* $Id: xp_socket.c,v 1.33.2.2.2.6.2.3 2008/03/10 19:54:47 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