[CRIU] [PATCH] img: Initialize "images are new" bool earlier

Pavel Emelyanov xemul at parallels.com
Tue Apr 14 07:21:37 PDT 2015


Doing it at inventory write time is too late. Other than this, inventory
isn't created for pre-dump, thus this one always generates v1 images.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>

---

diff --git a/cr-dump.c b/cr-dump.c
index ac41865..0ed02e7 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1678,6 +1678,8 @@ int cr_pre_dump_tasks(pid_t pid)
 		opts.final_state = TASK_ALIVE;
 	}
 
+	img_common_magic = true;
+
 	if (init_stats(DUMP_STATS))
 		goto err;
 
@@ -1769,6 +1771,8 @@ int cr_dump_tasks(pid_t pid)
 	int post_dump_ret = 0;
 	int ret = -1;
 
+	img_common_magic = true;
+
 	pr_info("========================================\n");
 	pr_info("Dumping processes (pid: %d)\n", pid);
 	pr_info("========================================\n");
diff --git a/image.c b/image.c
index 676a40e..4de1397 100644
--- a/image.c
+++ b/image.c
@@ -88,7 +88,6 @@ int write_img_inventory(void)
 	if (!img)
 		return -1;
 
-	img_common_magic = true;
 	he.img_version = CRTOOLS_IMAGES_V1_1;
 	he.fdinfo_per_id = true;
 	he.has_fdinfo_per_id = true;


More information about the CRIU mailing list