exec: fix error code when conmon fails

this is a cosmetic change that makes sure podman returns a sane error code when conmon dies underneath it

Signed-off-by: Peter Hunt <pehunt@redhat.com>
This commit is contained in:
Peter Hunt 2020-03-04 16:21:01 -05:00
parent 797da2a57b
commit 4632b81c81
1 changed files with 6 additions and 0 deletions

View File

@ -340,6 +340,12 @@ func (c *Container) Exec(tty, privileged bool, env map[string]string, cmd []stri
if lastErr != nil {
logrus.Errorf(lastErr.Error())
}
// ErrorConmonRead is a bogus value set by podman to indicate reading a value from
// conmon failed. Since it is specifically not a valid exit code, we should set
// a generic error here
if exitCodeData.data == define.ErrorConmonRead {
exitCodeData.data = define.ExecErrorCodeGeneric
}
lastErr = errors.Wrapf(define.ErrOCIRuntime, "non zero exit code: %d", exitCodeData.data)
}