From 7177938e60b81752a44a8116b3e7e399c24c4fcb Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Fri, 4 Feb 2022 20:41:07 +0000 Subject: [PATCH] criu-ns: use os.waitstatus_to_exitcode() os.WEXITSTATUS() returns the process exit status and it should be used only if WIFEXITED() is true, i.e., the process terminated normally. os.waitstatus_to_exitcode() does the same as os.WEXITSTATUS() but it also handles the case when the process has been terminated by a signal. Suggested-by: Andrei Vagin Signed-off-by: Radostin Stoyanov --- scripts/criu-ns | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/criu-ns b/scripts/criu-ns index 6aa618218f..930d20c800 100755 --- a/scripts/criu-ns +++ b/scripts/criu-ns @@ -68,7 +68,7 @@ def _wait_for_process_status(criu_pid): try: (pid, status) = os.wait() if pid == criu_pid: - return os.WEXITSTATUS(status) + return os.waitstatus_to_exitcode(status) except OSError: return -251