chiark / gitweb /
util: implement fd_nonbloc()/fd_cloexec()
[elogind.git] / manager.c
index 42059a500717f7fd77516ea63f12184783bea0e4..234fb93c1e49df31150343b990da138569b5c1ef 100644 (file)
--- a/manager.c
+++ b/manager.c
@@ -315,8 +315,11 @@ int manager_new(Manager **_m) {
         if ((r = manager_setup_cgroup(m)) < 0)
                 goto fail;
 
-        /* FIXME: this should be called only when the D-Bus bus daemon is running */
-        if ((r = bus_init(m)) < 0)
+        dbus_connection_set_change_sigpipe(FALSE);
+
+        /* Try to connect to the busses, if possible. */
+        if ((r = bus_init_system(m)) < 0 ||
+            (r = bus_init_api(m)) < 0)
                 goto fail;
 
         *_m = m;
@@ -364,7 +367,8 @@ void manager_free(Manager *m) {
 
         manager_shutdown_cgroup(m);
 
-        bus_done(m);
+        bus_done_api(m);
+        bus_done_system(m);
 
         hashmap_free(m->units);
         hashmap_free(m->jobs);
@@ -1175,8 +1179,8 @@ static int transaction_add_job_and_dependencies(Manager *m, JobType type, Unit *
                                 if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, !force, force, NULL)) < 0 && r != -EBADR)
                                         goto fail;
                         SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_WANTS], i)
-                                if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, false, force, NULL)) < 0 && r != -EBADR)
-                                        goto fail;
+                                if ((r = transaction_add_job_and_dependencies(m, JOB_START, dep, ret, false, force, NULL)) < 0)
+                                        log_warning("Cannot add dependency job for unit %s, ignoring: %s", unit_id(dep), strerror(-r));
                         SET_FOREACH(dep, ret->unit->meta.dependencies[UNIT_REQUISITE], i)
                                 if ((r = transaction_add_job_and_dependencies(m, JOB_VERIFY_ACTIVE, dep, ret, true, force, NULL)) < 0 && r != -EBADR)
                                         goto fail;