[CRIU] [PATCH] seize: set cr_errno in collect_pstree

Andrew Vagin avagin at openvz.org
Mon Aug 10 02:31:18 PDT 2015


Before cr_errno was called from open_pid_proc(), but
now it isn't called if a root task doesn't exist.

Reported-by: Mr Jenkins
Fixes: b9b0730cb12e ("ptrace: split task_seize into seize_catch_task and seize_wait_task")
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 seize.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/seize.c b/seize.c
index 86df3f0..1f007f1 100644
--- a/seize.c
+++ b/seize.c
@@ -9,6 +9,7 @@
 
 #include "compiler.h"
 #include "cr_options.h"
+#include "cr-errno.h"
 #include "pstree.h"
 #include "ptrace.h"
 #include "seize.h"
@@ -323,8 +324,10 @@ int collect_pstree(pid_t pid)
 
 	root_item->pid.real = pid;
 
-	if (seize_catch_task(pid))
+	if (seize_catch_task(pid)) {
+		set_cr_errno(ESRCH);
 		goto err;
+	}
 
 	ret = seize_wait_task(pid, -1, &dmpi(root_item)->pi_creds);
 	if (ret < 0)
-- 
2.4.3



More information about the CRIU mailing list