conmon: return the correct exit status
conmon: return the correct exit status

WEXITSTATUS(x) can be used only if WIFEXITED(x).  We were using it
also in the case the process exited because it was signaled.

Since we check for the exit_status both for the container and the
runtime, move the common code to a new function get_exit_status that
is used in both cases.

Signed-off-by: Giuseppe Scrivano <20002b7b24c75512093a71a58285826d5c504fca@redhat.com>

kubernetes-incubator/ocid,kubernetes-incubator/cri-o,kubernetes-incubator/cri-o,kubernetes-incubator/ocid,mikebrow/cri-o,rhatdan/cri-o,kubernetes-incubator/cri-o,kubernetes-incubator/ocid,mikebrow/cri-o,rhatdan/cri-o,jwhonce/ocid,jwhonce/ocid,mikebrow/cri-o,mikebrow/cri-o,vbatts/cri-o,rhatdan/cri-o,vbatts/cri-o,nalind/cri-o,nalind/cri-o,kubernetes-incubator/cri-o,vbatts/cri-o,vbatts/cri-o,rhatdan/cri-o,jwhonce/ocid,nalind/cri-o