mirror of
https://frontier.innolan.net/rainlance/c-ares.git
synced 2026-10-09 17:13:42 +00:00
add debug messages for initialization failures
This commit is contained in:
@@ -224,6 +224,7 @@ static int file_lookup(union ares_addr *addr, int family, struct hostent **host)
|
|||||||
switch(error)
|
switch(error)
|
||||||
{
|
{
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
|
case ESRCH:
|
||||||
return ARES_ENOTFOUND;
|
return ARES_ENOTFOUND;
|
||||||
default:
|
default:
|
||||||
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
|
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
|
||||||
|
|||||||
+16
-1
@@ -248,6 +248,7 @@ static int file_lookup(const char *name, int family, struct hostent **host)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
char **alias;
|
char **alias;
|
||||||
int status;
|
int status;
|
||||||
|
int error;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char PATH_HOSTS[MAX_PATH];
|
char PATH_HOSTS[MAX_PATH];
|
||||||
@@ -280,8 +281,22 @@ static int file_lookup(const char *name, int family, struct hostent **host)
|
|||||||
|
|
||||||
fp = fopen(PATH_HOSTS, "r");
|
fp = fopen(PATH_HOSTS, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
|
{
|
||||||
|
error = ERRNO;
|
||||||
|
switch(error)
|
||||||
|
{
|
||||||
|
case ENOENT:
|
||||||
|
case ESRCH:
|
||||||
return ARES_ENOTFOUND;
|
return ARES_ENOTFOUND;
|
||||||
|
default:
|
||||||
|
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
|
||||||
|
error, strerror(error)));
|
||||||
|
DEBUGF(fprintf(stderr, "Error opening file: %s\n",
|
||||||
|
PATH_HOSTS));
|
||||||
|
*host = NULL;
|
||||||
|
return ARES_EFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
|
while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
|
||||||
{
|
{
|
||||||
if (strcasecmp((*host)->h_name, name) == 0)
|
if (strcasecmp((*host)->h_name, name) == 0)
|
||||||
|
|||||||
@@ -639,6 +639,7 @@ DhcpNameServer
|
|||||||
error = ERRNO;
|
error = ERRNO;
|
||||||
switch(error) {
|
switch(error) {
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
|
case ESRCH:
|
||||||
status = ARES_EOF;
|
status = ARES_EOF;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -664,6 +665,7 @@ DhcpNameServer
|
|||||||
error = ERRNO;
|
error = ERRNO;
|
||||||
switch(error) {
|
switch(error) {
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
|
case ESRCH:
|
||||||
status = ARES_EOF;
|
status = ARES_EOF;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -690,6 +692,7 @@ DhcpNameServer
|
|||||||
error = ERRNO;
|
error = ERRNO;
|
||||||
switch(error) {
|
switch(error) {
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
|
case ESRCH:
|
||||||
status = ARES_EOF;
|
status = ARES_EOF;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -716,6 +719,7 @@ DhcpNameServer
|
|||||||
error = ERRNO;
|
error = ERRNO;
|
||||||
switch(error) {
|
switch(error) {
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
|
case ESRCH:
|
||||||
status = ARES_EOF;
|
status = ARES_EOF;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ static int single_domain(ares_channel channel, const char *name, char **s)
|
|||||||
switch(error)
|
switch(error)
|
||||||
{
|
{
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
|
case ESRCH:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
|
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user