summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/manager.c22
-rw-r--r--src/manager.h2
-rw-r--r--src/snapshot.c2
3 files changed, 19 insertions, 7 deletions
diff --git a/src/manager.c b/src/manager.c
index a643263213..bd4f4659af 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2279,6 +2279,8 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
log_debug("Deserializing state...");
+ m->deserializing = true;
+
for (;;) {
Unit *u;
char name[UNIT_NAME_MAX+2];
@@ -2288,22 +2290,30 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
if (feof(f))
break;
- return -errno;
+ r = -errno;
+ goto finish;
}
char_array_0(name);
if ((r = manager_load_unit(m, strstrip(name), NULL, NULL, &u)) < 0)
- return r;
+ goto finish;
if ((r = unit_deserialize(u, f, fds)) < 0)
- return r;
+ goto finish;
}
- if (ferror(f))
- return -EIO;
+ if (ferror(f)) {
+ r = -EIO;
+ goto finish;
+ }
- return 0;
+ r = 0;
+
+finish:
+ m->deserializing = false;
+
+ return r;
}
int manager_reload(Manager *m) {
diff --git a/src/manager.h b/src/manager.h
index e5cf3a1c52..b44ffe27ce 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -193,6 +193,8 @@ struct Manager {
bool utmp_reboot_written:1;
+ bool deserializing:1;
+
bool show_status;
bool confirm_spawn;
};
diff --git a/src/snapshot.c b/src/snapshot.c
index fe8a43dd3a..11e7c3e28d 100644
--- a/src/snapshot.c
+++ b/src/snapshot.c
@@ -56,7 +56,7 @@ static int snapshot_load(Unit *u) {
/* Make sure that only snapshots created via snapshot_create()
* can be loaded */
- if (!s->by_snapshot_create)
+ if (!s->by_snapshot_create && !s->meta.manager->deserializing)
return -ENOENT;
u->meta.load_state = UNIT_LOADED;