+4567. [port] Call getprotobyname and getservbyname prior to calling
+ chroot so that shared libraries get loaded. [RT #44537]
+
4565. [cleanup] The inline macro versions of isc_buffer_put*()
did not implement automatic buffer reallocation.
[RT #44216]
#include <isc/dir.h>
#include <isc/magic.h>
+#include <isc/netdb.h>
#include <isc/string.h>
#include <isc/util.h>
REQUIRE(dirname != NULL);
#ifdef HAVE_CHROOT
+ /*
+ * Try to use getservbyname and getprotobyname before chroot.
+ * If WKS records are used in a zone under chroot, Name Service Switch
+ * may fail to load library in chroot.
+ * Do not report errors if it fails, we do not need any result now.
+ */
+ getprotobyname("udp") && getservbyname("domain", "udp");
+
if (chroot(dirname) < 0 || chdir("/") < 0)
return (isc__errno2result(errno));