aboutsummaryrefslogtreecommitdiff
path: root/ares/ares_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'ares/ares_init.c')
-rw-r--r--ares/ares_init.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/ares/ares_init.c b/ares/ares_init.c
index b0fa50f2b..5268745d0 100644
--- a/ares/ares_init.c
+++ b/ares/ares_init.c
@@ -610,6 +610,7 @@ DhcpNameServer
char *p;
FILE *fp;
int linesize;
+ int error;
fp = fopen(PATH_RESOLV_CONF, "r");
if (fp) {
@@ -635,13 +636,14 @@ DhcpNameServer
fclose(fp);
}
else {
- switch(errno) {
+ error = ERRNO;
+ switch(error) {
case ENOENT:
status = ARES_EOF;
break;
default:
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
- errno, strerror(errno)));
+ error, strerror(error)));
DEBUGF(fprintf(stderr, "Error opening file: %s\n", PATH_RESOLV_CONF));
status = ARES_EFILE;
}
@@ -659,13 +661,14 @@ DhcpNameServer
fclose(fp);
}
else {
- switch(errno) {
+ error = ERRNO;
+ switch(error) {
case ENOENT:
status = ARES_EOF;
break;
default:
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
- errno, strerror(errno)));
+ error, strerror(error)));
DEBUGF(fprintf(stderr, "Error opening file: %s\n", "/etc/nsswitch.conf"));
status = ARES_EFILE;
}
@@ -684,13 +687,14 @@ DhcpNameServer
fclose(fp);
}
else {
- switch(errno) {
+ error = ERRNO;
+ switch(error) {
case ENOENT:
status = ARES_EOF;
break;
default:
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
- errno, strerror(errno)));
+ error, strerror(error)));
DEBUGF(fprintf(stderr, "Error opening file: %s\n", "/etc/host.conf"));
status = ARES_EFILE;
}
@@ -709,13 +713,14 @@ DhcpNameServer
fclose(fp);
}
else {
- switch(errno) {
+ error = ERRNO;
+ switch(error) {
case ENOENT:
status = ARES_EOF;
break;
default:
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
- errno, strerror(errno)));
+ error, strerror(error)));
DEBUGF(fprintf(stderr, "Error opening file: %s\n", "/etc/svc.conf"));
status = ARES_EFILE;
}