diff options
author | Andrey Hristov <andrey@php.net> | 2008-03-10 19:54:47 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2008-03-10 19:54:47 +0000 |
commit | 49add03404141a0af3683471f2aa967818ba350e (patch) | |
tree | fe5328993e19a04c8f25f6d1fbce08e7b0cfd7b5 /main/network.c | |
parent | 23bb85388bd17dcbc154ee0c4f585828fe900311 (diff) | |
download | php-git-49add03404141a0af3683471f2aa967818ba350e.tar.gz |
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.
Diffstat (limited to 'main/network.c')
-rw-r--r-- | main/network.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/main/network.c b/main/network.c index d8996aa556..db4fc7bd80 100644 --- a/main/network.c +++ b/main/network.c @@ -205,10 +205,12 @@ static int php_network_getaddresses(const char *host, int socktype, struct socka # 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 @@ static int php_network_getaddresses(const char *host, int socktype, struct socka /* 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); |