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.7&r2=1.118.2.2.2.8&diff_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.7        Mon 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.8&r2=1.33.2.2.2.9&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.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.c    Mon 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

Reply via email to