diff --git a/Makefile.am b/Makefile.am index 7b16cad2..fd90f500 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,7 @@ EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \ lib_LTLIBRARIES = libevent.la libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c event_tagging.c \ - http.c evhttp.h http-internal.h + http.c evhttp.h http-internal.h evdns.c evdns.h libevent_la_LIBADD = @LTLIBOBJS@ libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:3:0 diff --git a/configure.in b/configure.in index 45ec39e6..a3f0a39e 100644 --- a/configure.in +++ b/configure.in @@ -117,9 +117,15 @@ AC_C_INLINE AC_HEADER_TIME dnl Checks for library functions. -AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime) +AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r) AC_REPLACE_FUNCS(strlcpy) +if test "x$ac_cv_func_clock_gettime" = "xyes"; then + AC_DEFINE(DNS_USE_CPU_CLOCK_FOR_ID, 1, [Define if clock_gettime is available in libc]) +else + AC_DEFINE(DNS_USE_GETTIMEOFDAY_FOR_ID, 1, [Define is no secure id variant is available]) +fi + AC_MSG_CHECKING(for F_SETFD in fcntl.h) AC_EGREP_CPP(yes, [ diff --git a/evdns.c b/evdns.c index afead96f..3bccac66 100644 --- a/evdns.c +++ b/evdns.c @@ -222,8 +222,11 @@ * with the next probe. */ -#include "eventdns.h" -#include "eventdns_tor.h" +#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + //#define NDEBUG #ifndef DNS_USE_CPU_CLOCK_FOR_ID @@ -258,7 +261,6 @@ #define _FORTIFY_SOURCE 3 #include -#include #include #include #include @@ -276,6 +278,8 @@ #include #include +#include "evdns.h" + #ifndef HOST_NAME_MAX #define HOST_NAME_MAX 255 #endif @@ -299,8 +303,6 @@ typedef unsigned int uint; #define u16 uint16_t #define u8 uint8_t -#include "eventdns.h" - #define MAX_ADDRS 4 // maximum number of addresses from a single packet // which we bother recording @@ -847,7 +849,7 @@ transaction_id_pick(void) { #ifdef DNS_USE_CPU_CLOCK_FOR_ID struct timespec ts; const u16 trans_id = ts.tv_nsec & 0xffff; - if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts)) abort(); + if (clock_gettime(CLOCK_PROF, &ts)) abort(); #endif #ifdef DNS_USE_GETTIMEOFDAY_FOR_ID