[CRIU] [PATCH] page-read: add proper processing of return value

Tikhomirov Pavel snorcht at gmail.com
Tue Dec 17 05:48:13 PST 2013


when get an error reading image file need stop restore

Signed-off-by: Tikhomirov Pavel <snorcht at gmail.com>
---
 cr-restore.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 6a0637e..de0cf2c 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -382,7 +382,7 @@ static int restore_priv_vma_content(pid_t pid)
 
 				ret = pr.read_page(&pr, va, buf);
 				if (ret < 0)
-					break;
+					goto err_read;
 				va += PAGE_SIZE;
 
 				if (memcmp(p, buf, PAGE_SIZE) == 0) {
@@ -394,7 +394,7 @@ static int restore_priv_vma_content(pid_t pid)
 			} else {
 				ret = pr.read_page(&pr, va, p);
 				if (ret < 0)
-					break;
+					goto err_read;
 				va += PAGE_SIZE;
 			}
 
@@ -405,6 +405,7 @@ static int restore_priv_vma_content(pid_t pid)
 			pr.put_pagemap(&pr);
 	}
 
+err_read:
 	pr.close(&pr);
 	if (ret < 0)
 		return ret;
-- 
1.7.9.5



More information about the CRIU mailing list