From: Lennart Poettering Date: Mon, 11 Jun 2007 16:43:47 +0000 (+0000) Subject: use libdaemon's new daemon_close_all() function to close all fds when daemonizing... X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=6189e8b44a5d38adb27524842005af3f347fd631;p=catta use libdaemon's new daemon_close_all() function to close all fds when daemonizing. This requires libdaemon 0.11 (not yet released) to work, hence also bump the dep. git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1487 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c index 9f55473..884ad2e 100644 --- a/avahi-daemon/main.c +++ b/avahi-daemon/main.c @@ -1249,6 +1249,11 @@ int main(int argc, char *argv[]) { if (config.use_syslog || config.daemonize) daemon_log_use = DAEMON_LOG_SYSLOG; + if (daemon_close_all(-1) < 0) { + avahi_log_error("Failed to close remaining file descriptors: %s", strerror(errno)); + goto finish; + } + if (make_runtime_dir() < 0) goto finish; diff --git a/configure.ac b/configure.ac index 7632b37..1b3a6f6 100644 --- a/configure.ac +++ b/configure.ac @@ -659,7 +659,7 @@ AC_ARG_ENABLE(libdaemon, [HAVE_LIBDAEMON=yes]) if test "x$HAVE_LIBDAEMON" = "xyes" ; then - PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ]) + PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.11 ]) AC_SUBST(LIBDAEMON_CFLAGS) AC_SUBST(LIBDAEMON_LIBS) fi