[CRIU] [PATCH 4/4] exec: return non-zero code in error cases

Andrey Vagin avagin at openvz.org
Wed Jul 13 15:14:04 PDT 2016


From: Andrew Vagin <avagin at virtuozzo.com>

[root at fc22-vm criu]# ./criu/criu exec -t 27573 dup21 3 0
Error (cr-exec.c:164): Unknown syscall [dup21]
[root at fc22-vm criu]# echo 0
0

Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 criu/cr-exec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/criu/cr-exec.c b/criu/cr-exec.c
index f6c2396..26a8497 100644
--- a/criu/cr-exec.c
+++ b/criu/cr-exec.c
@@ -118,7 +118,7 @@ int cr_exec(int pid, char **opt)
 	struct syscall_exec_desc *si;
 	struct parasite_ctl *ctl;
 	struct vm_area_list vmas;
-	int ret = -1, prev_state;
+	int ret, prev_state, exit_code = -1;
 	struct proc_status_creds *creds;
 
 	if (!sys_name) {
@@ -166,13 +166,16 @@ int cr_exec(int pid, char **opt)
 	}
 
 	ret = execute_syscall(ctl, si, opt + 1);
-	if (ret < 0)
+	if (ret < 0) {
 		pr_err("Can't execute syscall remotely\n");
+		goto out_cure;
+	}
 
+	exit_code = 0;
 out_cure:
 	parasite_cure_seized(ctl);
 out_unseize:
 	unseize_task(pid, prev_state, prev_state);
 out:
-	return ret;
+	return exit_code;
 }
-- 
2.7.4



More information about the CRIU mailing list