]> git.meshlink.io Git - catta/blobdiff - avahi-daemon/main.c
update todo
[catta] / avahi-daemon / main.c
index 6110cbcd13dae3403cc0cf9879b702542b0dff3b..75d01aabc25eb0ee7f1438c5cec7fab38b8fb777 100644 (file)
@@ -78,10 +78,8 @@ typedef struct {
     int daemonize;
     int use_syslog;
     char *config_file;
-#ifdef HAVE_DBUS
     int enable_dbus;
     int fail_on_missing_dbus;
-#endif
     int drop_root;
     int publish_resolv_conf;
     char ** publish_dns_servers;
@@ -394,10 +392,6 @@ static int load_config_file(DaemonConfig *c) {
                     } else {
                         c->enable_dbus = 0;
                     }
-#ifdef HAVE_DBUS                
-                    if (c->enable_dbus == 1) 
-                        avahi_log_warn("Avahi was compiled without d-bus support but you requested it was enabled in the config file");
-#endif
                 }
                 else if (strcasecmp(p->key, "drop-root") == 0)
                     c->drop_root = is_yes(p->value);
@@ -601,9 +595,8 @@ static int run_server(DaemonConfig *c) {
 
     if (simple_protocol_setup(poll_api) < 0)
         goto finish;
-    
+    if (c->enable_dbus) {
 #ifdef HAVE_DBUS
-    if (c->enable_dbus)
         if (dbus_protocol_setup(poll_api) < 0) {
 
             if (c->fail_on_missing_dbus)
@@ -612,7 +605,11 @@ static int run_server(DaemonConfig *c) {
             avahi_log_warn("WARNING: Failed to contact D-BUS daemon, disabling D-BUS support.");
             c->enable_dbus = 0;
         }
+#else
+        avahi_log_warn("WARNING: We are configured to enable D-BUS but it was not compiled in");
+        c->enable_dbus = 0;
 #endif
+    }
     
     load_resolv_conf(c);
     static_service_load();
@@ -851,6 +848,9 @@ int main(int argc, char *argv[]) {
 #ifdef HAVE_DBUS
     config.enable_dbus = 1;
     config.fail_on_missing_dbus = 1;
+#else
+    config.enable_dbus = 0;
+    config.fail_on_missing_dbus = 0;
 #endif
     config.drop_root = 1;
     config.publish_dns_servers = NULL;