Browse Source

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.
experimental/first_unicode_implementation
Andrey Hristov 19 years ago
parent
commit
af5a93e552
  1. 9
      main/network.c
  2. 2
      main/streams/xp_socket.c

9
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);

2
main/streams/xp_socket.c

@ -601,7 +601,7 @@ static inline int php_tcp_sockop_connect(php_stream *stream, php_netstream_data_
{
char *host = NULL, *bindto = NULL;
int portno, bindport = 0;
int err;
int err = 0;
int ret;
zval **tmpzval = NULL;

Loading…
Cancel
Save