diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-04-24 16:09:15 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-04-24 16:14:46 +0200 |
commit | 007c6337c6ddf2eb1e7db4d9cd00b044d6d8e165 (patch) | |
tree | 922dc4ed90b7fb68daeb9a98faa729ca6e3026dc | |
parent | f78f265f405a61387c6c12a879ac0d6b6dc958db (diff) |
manager: don't fail fatally if we cannot coldplug a unit
It's better to continue as good as we can, than to totally fail. Hence,
let's log about the failure and continue.
-rw-r--r-- | src/core/manager.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index 39a868fed6..f13dad538f 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -975,28 +975,25 @@ int manager_enumerate(Manager *m) { return r; } -static int manager_coldplug(Manager *m) { - int r = 0; +static void manager_coldplug(Manager *m) { Iterator i; Unit *u; char *k; + int r; assert(m); /* Then, let's set up their initial state. */ HASHMAP_FOREACH_KEY(u, k, m->units, i) { - int q; /* ignore aliases */ if (u->id != k) continue; - q = unit_coldplug(u); - if (q < 0) - r = q; + r = unit_coldplug(u); + if (r < 0) + log_warning_errno(r, "We couldn't coldplug %s, proceeding anyway: %m", u->id); } - - return r; } static void manager_build_unit_path_cache(Manager *m) { @@ -1140,9 +1137,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) { bus_track_coldplug(m, &m->subscribed, &m->deserialized_subscribed); /* Third, fire things up! */ - q = manager_coldplug(m); - if (q < 0 && r == 0) - r = q; + manager_coldplug(m); if (serialization) { assert(m->n_reloading > 0); @@ -2560,9 +2555,7 @@ int manager_reload(Manager *m) { r = q; /* Third, fire things up! */ - q = manager_coldplug(m); - if (q < 0 && r >= 0) - r = q; + manager_coldplug(m); assert(m->n_reloading > 0); m->n_reloading--; |