/* Define to 1 if you have the `chroot' function. */
#undef HAVE_CHROOT
+/* Define to 1 if you have the `daemon' function. */
+#undef HAVE_DAEMON
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
-for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob initgroups
+
+for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob initgroups daemon
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
if test $ac_cv_func_getaddrinfo = no; then
AC_LIBOBJ([fake-rfc2553])
fi
-AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob initgroups])
+AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob initgroups daemon])
# check if setreuid en setregid fail, on MacOSX10.4(darwin8).
if echo $build_os | grep darwin8 > /dev/null; then
static void
detach(void)
{
+#ifdef HAVE_DAEMON
+ /* use POSIX daemon(3) function */
+ if(daemon(1, 0) != 0)
+ fatal_exit("daemon failed: %s", strerror(errno));
+#else /* no HAVE_DAEMON */
#ifdef HAVE_WORKING_FORK
int fd;
/* Take off... */
(void)close(fd);
}
#endif /* HAVE_WORKING_FORK */
+#endif /* HAVE_DAEMON */
}
/** daemonize, drop user priviliges and chroot if needed */
inluded ldns package with the unbound source. The -I include
is put before the others, so it avoids bad include files from
an older ldns install.
+ - daemon(3) posix call is used when available.
4 February 2009: Wouter
- tag for release 1.2.1.
o #231: unbound_checkconf options to output config file data.
o config entry to denote that a zone is to be treated as unsigned (even if
a DS exists to higher trust anchor).
-o see if we can use daemon(3), cleaner posix usage.
o see if we can include the python bindings (contrib).
o see if we can suport var:value (nospace) by parser.
o remote control read ssl information while priviledged.