From 20d8277451d8fd7cbce316b80a0018bc2639335d Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 18 Nov 2023 23:09:46 +0000 Subject: Fix old _BSD_SOURCE definitions Signed-off-by: Laurent Bercot --- NEWS | 7 ++++--- doc/libs6dns/hosts.html | 3 ++- doc/libs6dns/index.html | 5 +++-- src/include/s6-dns/hosts.h | 2 ++ src/libs6dns/s6dns_debug_dumpdt_pre_send.c | 8 ++++---- src/skadns/skadns_cancel.c | 7 +++---- src/skadns/skadns_release.c | 7 +++---- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 669b8ce..3656f2a 100644 --- a/NEWS +++ b/NEWS @@ -3,10 +3,11 @@ Changelog for s6-dns. In 2.3.7.0 ---------- - - New s6dns_init_options() function, -to choose whether to support /etc/hosts or not. - - Properly ignore link-local addresses in /etc/hosts + - New s6dns_init_options() function, to choose whether +to support /etc/hosts or not. + - Properly ignore link-local addresses in hosts files instead of erroring out on them. + - New s6dns_hosts_name46() macro. In 2.3.6.0 diff --git a/doc/libs6dns/hosts.html b/doc/libs6dns/hosts.html index b9a03bf..00da38f 100644 --- a/doc/libs6dns/hosts.html +++ b/doc/libs6dns/hosts.html @@ -80,7 +80,8 @@ which should be in /etc/hosts format, into a cdb file written to file descriptor fdw. fdr must be open for reading, and fdw must be open for writing and seekable. The function returns 1 on success and 0 (and sets errno) -on failure. +on failure. A syntax error in the text file results in failure, +but link-local addresses are silently ignored.

diff --git a/doc/libs6dns/index.html b/doc/libs6dns/index.html index 6320376..6dcb408 100644 --- a/doc/libs6dns/index.html +++ b/doc/libs6dns/index.html @@ -98,8 +98,9 @@ header: s6dns_init() calls s6dns_rci_init(), extracting resolv.conf information to an internal global variable. The function returns 1 on success, and 0 (and sets errno) -on failure. -

  • Call s6dns_finish() when you're done with the libs6dns. +on failure. To also use the hosts database, you can call +s6dns_init_options(1) instead.
  • +
  • Call s6dns_finish() when you're done with libs6dns. It frees the resources used.
  • diff --git a/src/include/s6-dns/hosts.h b/src/include/s6-dns/hosts.h index f9ac48e..4d7f1c8 100644 --- a/src/include/s6-dns/hosts.h +++ b/src/include/s6-dns/hosts.h @@ -3,6 +3,7 @@ #ifndef S6DNS_HOSTS_H #define S6DNS_HOSTS_H +#include #include #include #include @@ -26,6 +27,7 @@ extern int s6dns_hosts_name_r (cdb const *, char const *, stralloc *, genalloc * #define s6dns_hosts_name(ip, sa, ga, is6) s6dns_hosts_name_r(&s6dns_hosts_here, (ip), sa, ga, is6) #define s6dns_hosts_name4(ip, sa, ga) s6dns_hosts_name4_r(&s6dns_hosts_here, (ip), sa, ga) #define s6dns_hosts_name6(ip, sa, ga) s6dns_hosts_name6_r(&s6dns_hosts_here, (ip), sa, ga) +#define s6dns_hosts_name46(i, sa, ga) s6dns_hosts_name((i)->ip, sa, (ga), (i)->is6) /* name to IP. noq: name is an fqdn. unq: name is unqualified. */ diff --git a/src/libs6dns/s6dns_debug_dumpdt_pre_send.c b/src/libs6dns/s6dns_debug_dumpdt_pre_send.c index 0d4ae19..c64f2ca 100644 --- a/src/libs6dns/s6dns_debug_dumpdt_pre_send.c +++ b/src/libs6dns/s6dns_debug_dumpdt_pre_send.c @@ -1,17 +1,17 @@ /* ISC license */ -/* For EOVERFLOW in OpenBSD */ -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif +/* For EOVERFLOW */ +#include #include #include #include + #include #include #include #include + #include #include #include diff --git a/src/skadns/skadns_cancel.c b/src/skadns/skadns_cancel.c index 3b8eff6..2b3753f 100644 --- a/src/skadns/skadns_cancel.c +++ b/src/skadns/skadns_cancel.c @@ -1,15 +1,14 @@ /* ISC license. */ -/* OpenBSD sucks. In other news, the sky is blue. */ -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif +#include #include + #include #include #include #include + #include int skadns_cancel (skadns_t *a, uint16_t id, tain const *deadline, tain *stamp) diff --git a/src/skadns/skadns_release.c b/src/skadns/skadns_release.c index 26c9c4f..c64016c 100644 --- a/src/skadns/skadns_release.c +++ b/src/skadns/skadns_release.c @@ -1,13 +1,12 @@ /* ISC license. */ -/* OpenBSD sucks. More news at 11. */ -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif +#include #include + #include #include + #include int skadns_release (skadns_t *a, uint16_t id) -- cgit v1.2.3