]> git.meshlink.io Git - catta/blobdiff - avahi-daemon/main.c
* add LGPL blurbs to some more files shipped with avahi
[catta] / avahi-daemon / main.c
index 44300ffc0fbc759cf51b5fa3784b3a4ec88994ac..821820ee9baa62ada2646cdb0fdfd2573ed9414e 100644 (file)
@@ -703,6 +703,7 @@ static int run_server(DaemonConfig *c) {
     int error;
     const AvahiPoll *poll_api = NULL;
     AvahiWatch *sig_watch = NULL;
+    int retval_is_sent = 0;
 
     assert(c);
 
@@ -747,14 +748,14 @@ static int run_server(DaemonConfig *c) {
             goto finish;
         }
         
+        avahi_log_info("Successfully called chroot().");
         chdir("/");
         
         if (avahi_caps_drop_all() < 0) {
             avahi_log_error("Failed to drop capabilities.");
             goto finish;
         }
-
-        avahi_log_info("chroot() successful.");
+        avahi_log_info("Successfully dropped remaining capabilities.");
     }
     
 #endif
@@ -773,8 +774,10 @@ static int run_server(DaemonConfig *c) {
 
     update_wide_area_servers();
 
-    if (c->daemonize)
+    if (c->daemonize) {
         daemon_retval_send(0);
+       retval_is_sent = 1;
+    }
 
     for (;;) {
         if ((r = avahi_simple_poll_iterate(simple_poll_api, -1)) < 0) {
@@ -819,7 +822,7 @@ finish:
         simple_poll_api = NULL;
     }
 
-    if (r != 0 && c->daemonize)
+    if (!retval_is_sent && c->daemonize)
         daemon_retval_send(1);
     
     return r;