[CRIU] [PATCH 07/15] Subject: [PATCH 07/14] pstree: Subblock for ids read on task restore

Pavel Emelyanov xemul at parallels.com
Mon Sep 29 01:48:31 PDT 2014


Ugly, but it's for easier further patching.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 pstree.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/pstree.c b/pstree.c
index 26c9568..ba9f965 100644
--- a/pstree.c
+++ b/pstree.c
@@ -318,7 +318,7 @@ static int prepare_pstree_for_shell_job(void)
 
 static int read_pstree_image(void)
 {
-	int ret = 0, i, ps_fd, fd;
+	int ret = 0, i, ps_fd;
 	struct pstree_item *pi, *parent = NULL;
 
 	pr_info("Reading image tree\n");
@@ -403,14 +403,19 @@ static int read_pstree_image(void)
 
 		pstree_entry__free_unpacked(e, NULL);
 
-		fd = open_image(CR_FD_IDS, O_RSTR, pi->pid.virt);
-		if (fd < 0) {
-			if (errno == ENOENT)
-				continue;
-			goto err;
+		{
+			int fd;
+
+			fd = open_image(CR_FD_IDS, O_RSTR, pi->pid.virt);
+			if (fd < 0) {
+				if (errno == ENOENT)
+					continue;
+				goto err;
+			}
+			ret = pb_read_one(fd, &pi->ids, PB_IDS);
+			close(fd);
 		}
-		ret = pb_read_one(fd, &pi->ids, PB_IDS);
-		close(fd);
+
 		if (ret != 1)
 			goto err;
 
-- 
1.8.4.2




More information about the CRIU mailing list