[CRIU] [PATCH 10/12] compel/infect: Detach but fail compel_resume_task()

Dmitry Safonov dima at arista.com
Sun Nov 10 01:20:43 MSK 2019


Unknown state means that the task in the end may be not in wanted state.
Return err code.

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 compel/src/lib/infect.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index 8b377e7d22d8..3fad85ed3c8f 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -313,6 +313,8 @@ err:
 
 int compel_resume_task(pid_t pid, int orig_st, int st)
 {
+	int ret = 0;
+
 	pr_debug("\tUnseizing %d into %d\n", pid, st);
 
 	if (st == COMPEL_TASK_DEAD) {
@@ -335,15 +337,17 @@ int compel_resume_task(pid_t pid, int orig_st, int st)
 		 */
 		if (orig_st == COMPEL_TASK_STOPPED)
 			kill(pid, SIGSTOP);
-	} else
+	} else {
 		pr_err("Unknown final state %d\n", st);
+		ret = -1;
+	}
 
 	if (ptrace(PTRACE_DETACH, pid, NULL, NULL)) {
 		pr_perror("Unable to detach from %d", pid);
 		return -1;
 	}
 
-	return 0;
+	return ret;
 }
 
 static int gen_parasite_saddr(struct sockaddr_un *saddr, int key)
-- 
2.24.0



More information about the CRIU mailing list