summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-05-16 01:15:03 +0200
committerLennart Poettering <lennart@poettering.net>2014-05-16 01:15:03 +0200
commit9bdb98c59451ed090f8d35d470a54710f389ce71 (patch)
tree0bdd3e80f97813558028125f18a190bf91be9fc8 /src/core/unit.c
parent2b1c3767515672dfd0f5e0a9c9d7ac3a16a6a361 (diff)
core: make sure to serialize jobs for all units
Previously we wouldn't serialize jobs for units that themselves have nothing to serialize. http://lists.freedesktop.org/archives/systemd-devel/2014-May/019051.html
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index c4ed923373..41651bab87 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2288,25 +2288,25 @@ bool unit_can_serialize(Unit *u) {
}
int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) {
- ExecRuntime *rt;
int r;
assert(u);
assert(f);
assert(fds);
- if (!unit_can_serialize(u))
- return 0;
-
- r = UNIT_VTABLE(u)->serialize(u, f, fds);
- if (r < 0)
- return r;
+ if (unit_can_serialize(u)) {
+ ExecRuntime *rt;
- rt = unit_get_exec_runtime(u);
- if (rt) {
- r = exec_runtime_serialize(rt, u, f, fds);
+ r = UNIT_VTABLE(u)->serialize(u, f, fds);
if (r < 0)
return r;
+
+ rt = unit_get_exec_runtime(u);
+ if (rt) {
+ r = exec_runtime_serialize(rt, u, f, fds);
+ if (r < 0)
+ return r;
+ }
}
dual_timestamp_serialize(f, "inactive-exit-timestamp", &u->inactive_exit_timestamp);
@@ -2368,17 +2368,14 @@ void unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value) {
}
int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
- size_t offset;
ExecRuntime **rt = NULL;
+ size_t offset;
int r;
assert(u);
assert(f);
assert(fds);
- if (!unit_can_serialize(u))
- return 0;
-
offset = UNIT_VTABLE(u)->exec_runtime_offset;
if (offset > 0)
rt = (ExecRuntime**) ((uint8_t*) u + offset);
@@ -2503,17 +2500,19 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
continue;
}
- if (rt) {
- r = exec_runtime_deserialize_item(rt, u, l, v, fds);
+ if (unit_can_serialize(u)) {
+ if (rt) {
+ r = exec_runtime_deserialize_item(rt, u, l, v, fds);
+ if (r < 0)
+ return r;
+ if (r > 0)
+ continue;
+ }
+
+ r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds);
if (r < 0)
return r;
- if (r > 0)
- continue;
}
-
- r = UNIT_VTABLE(u)->deserialize_item(u, l, v, fds);
- if (r < 0)
- return r;
}
}