X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/30631bd56b6a2fc3b938bc1fd9fa76ccae0be7eb..b8c10cda08d48348f422bb3d31f019584cf252c9:/evdns.c?ds=inline diff --git a/evdns.c b/evdns.c index 6ba23f1..78fbd3c 100644 --- a/evdns.c +++ b/evdns.c @@ -1,4 +1,5 @@ #define DNS_USE_GETTIMEOFDAY_FOR_ID 1 +#define HAVE_STRUCT_IN6_ADDR 1 /* The original version of this module was written by Adam Langley; for * a history of modifications, check out the subversion logs. @@ -40,7 +41,6 @@ #endif #ifdef WIN32 -#include "misc.h" #endif /* #define NDEBUG */ @@ -175,7 +175,7 @@ struct request { }; #ifndef HAVE_STRUCT_IN6_ADDR -struct xin6_addr { +struct in6_addr { u8 s6_addr[16]; }; #endif @@ -190,7 +190,7 @@ struct reply { } a; struct { u32 addrcount; - struct xin6_addr addresses[MAX_ADDRS]; + struct in6_addr addresses[MAX_ADDRS]; } aaaa; struct { char name[HOST_NAME_MAX]; @@ -2265,7 +2265,7 @@ int evdns_resolve_reverse(struct in_addr *in, int flags, evdns_callback_type cal return 0; } -int evdns_resolve_reverse_ipv6(struct xin6_addr *in, int flags, evdns_callback_type callback, void *ptr) { +int evdns_resolve_reverse_ipv6(struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr) { char buf[96]; char *cp; struct request *req; @@ -2544,6 +2544,12 @@ evdns_resolv_set_defaults(int flags) { if (flags & DNS_OPTION_NAMESERVERS) evdns_nameserver_ip_add("127.0.0.1"); } +#ifndef HAVE_STRTOK_R +static char * +fake_strtok_r(char *s, const char *delim, char **state) { + return strtok(s, delim); +} +#endif /* helper version of atoi which returns -1 on error */ static int @@ -2616,9 +2622,9 @@ static void resolv_conf_parse_line(char *const start, int flags) { char *strtok_state; static const char *const delims = " \t"; -#define NEXT_TOKEN strtok(NULL, delims, &strtok_state) +#define NEXT_TOKEN fake_strtok_r(NULL, delims, &strtok_state) - char *const first_token = strtok(start, delims, &strtok_state); + char *const first_token = fake_strtok_r(start, delims, &strtok_state); if (!first_token) return; if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) {