diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 4813621..29ba324 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -9,7 +9,8 @@ ACLOCAL_AMFLAGS = -I m4 --install AM_CPPFLAGS = -I$(top_builddir)/include \ -I$(top_builddir)/src/lib \ -I$(top_srcdir)/include \ - -I$(top_srcdir)/src/lib + -I$(top_srcdir)/src/lib \ + -DSYSCONFDIR=\"$(sysconfdir)\" lib_LTLIBRARIES = libcares.la diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 6b42bb8..99b2b04 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -531,7 +531,7 @@ ACLOCAL_AMFLAGS = -I m4 --install # might possibly already be installed in the system. AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_builddir)/src/lib \ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib \ - $(am__append_4) + -DSYSCONFDIR=\"$(sysconfdir)\" $(am__append_4) lib_LTLIBRARIES = libcares.la man_MANS = $(MANPAGES) diff --git a/src/lib/ares_init.c b/src/lib/ares_init.c index de5d86c..b388c52 100644 --- a/src/lib/ares_init.c +++ b/src/lib/ares_init.c @@ -1756,7 +1756,7 @@ static int init_by_resolv_conf(ares_channel channel) if ((status == ARES_EOF) && (!channel->lookups)) { /* Many systems (Solaris, Linux, BSD's) use nsswitch.conf */ - fp = fopen("/etc/nsswitch.conf", "r"); + fp = fopen(SYSCONFDIR "/nsswitch.conf", "r"); if (fp) { while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) @@ -1776,7 +1776,7 @@ static int init_by_resolv_conf(ares_channel channel) DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n", error, strerror(error))); DEBUGF(fprintf(stderr, "Error opening file: %s\n", - "/etc/nsswitch.conf")); + SYSCONFDIR "/nsswitch.conf")); } /* ignore error, maybe we will get luck in next if clause */ diff --git a/src/lib/ares_private.h b/src/lib/ares_private.h index 60d69e0..c8d85b4 100644 --- a/src/lib/ares_private.h +++ b/src/lib/ares_private.h @@ -92,11 +92,11 @@ W32_FUNC const char *_w32_GetHostsFile (void); #else -#define PATH_RESOLV_CONF "/etc/resolv.conf" +#define PATH_RESOLV_CONF SYSCONFDIR "/resolv.conf" #ifdef ETC_INET -#define PATH_HOSTS "/etc/inet/hosts" +#define PATH_HOSTS SYSCONFDIR "/inet/hosts" #else -#define PATH_HOSTS "/etc/hosts" +#define PATH_HOSTS SYSCONFDIR "/hosts" #endif #endif