]> git.meshlink.io Git - catta/blobdiff - avahi-daemon/main.c
get rid of a lot of old svn cruft
[catta] / avahi-daemon / main.c
index c3cbb0e898f9a4025de28cbe4fe1d5a652388ef3..c4983e55f89f9c1a6fbedb10e38776768d6c8eda 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of avahi.
 
@@ -79,6 +77,7 @@
 #include "static-services.h"
 #include "static-hosts.h"
 #include "ini-file-parser.h"
+#include "sd-daemon.h"
 
 #ifdef HAVE_DBUS
 #include "dbus-protocol.h"
@@ -1455,10 +1454,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 (sd_listen_fds(0) <= 0)
+            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;