Skip to content

Commit

Permalink
criu-ns: use os.waitstatus_to_exitcode()
Browse files Browse the repository at this point in the history
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 <avagin@gmail.com>
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
  • Loading branch information
rst0git authored and avagin committed Apr 29, 2022
1 parent bb1b168 commit 7177938
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/criu-ns
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7177938

Please sign in to comment.