summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-07-10 19:24:03 +0200
committerLennart Poettering <lennart@poettering.net>2013-07-10 23:41:03 +0200
commit6fa4853328e3d78d092172fa54effb7e785d0a85 (patch)
treedf7ec622c6f825f6470be62f49dfcaac2d020e71 /src/core/manager.c
parent376dd21dc0757e8a6d3f60d6d21bb802a90f1983 (diff)
core: serialize/deserialize bus subscribers
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 6128194427..51f03de098 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -424,7 +424,7 @@ static void manager_strip_environment(Manager *m) {
strv_env_clean(m->environment);
}
-int manager_new(SystemdRunningAs running_as, Manager **_m) {
+int manager_new(SystemdRunningAs running_as, bool reexecuting, Manager **_m) {
Manager *m;
int r = -ENOMEM;
@@ -476,7 +476,8 @@ int manager_new(SystemdRunningAs running_as, Manager **_m) {
if (!m->cgroup_unit)
goto fail;
- if (!(m->watch_bus = hashmap_new(string_hash_func, string_compare_func)))
+ m->watch_bus = hashmap_new(string_hash_func, string_compare_func);
+ if (!m->watch_bus)
goto fail;
m->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
@@ -502,7 +503,7 @@ int manager_new(SystemdRunningAs running_as, Manager **_m) {
/* Try to connect to the busses, if possible. */
if ((running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS")) ||
running_as == SYSTEMD_SYSTEM) {
- r = bus_init(m, running_as != SYSTEMD_SYSTEM);
+ r = bus_init(m, reexecuting || running_as != SYSTEMD_SYSTEM);
if (r < 0)
goto fail;
} else
@@ -2041,6 +2042,8 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) {
}
}
+ bus_serialize(m, f);
+
fputc('\n', f);
HASHMAP_FOREACH_KEY(u, t, m->units, i) {
@@ -2054,7 +2057,8 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) {
fputs(u->id, f);
fputc('\n', f);
- if ((r = unit_serialize(u, f, fds, !switching_root)) < 0) {
+ r = unit_serialize(u, f, fds, !switching_root);
+ if (r < 0) {
m->n_reloading --;
return r;
}
@@ -2159,7 +2163,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
strv_free(m->environment);
m->environment = e;
- } else
+ } else if (bus_deserialize_item(m, l) == 0)
log_debug("Unknown serialization item '%s'", l);
}