diff options
-rw-r--r-- | libpod/container_api.go | 4 | ||||
-rw-r--r-- | libpod/define/exec_codes.go | 6 | ||||
-rw-r--r-- | libpod/oci_conmon_linux.go | 8 |
3 files changed, 5 insertions, 13 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index fc6cc4a49..e5174c02c 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -297,9 +297,7 @@ func (c *Container) Exec(tty, privileged bool, env map[string]string, cmd []stri // Conmon will pass a non-zero exit code from the runtime as a pid here. // we differentiate a pid with an exit code by sending it as negative, so reverse // that change and return the exit code the runtime failed with. - // Make sure the value is not ErrorConmonRead, as that is a podman set bogus value - // and not sent by conmon (and thus has no special meaning) - if pid < 0 && pid != define.ErrorConmonRead { + if pid < 0 { ec = -1 * pid } return ec, err diff --git a/libpod/define/exec_codes.go b/libpod/define/exec_codes.go index c2ec08666..f94616b33 100644 --- a/libpod/define/exec_codes.go +++ b/libpod/define/exec_codes.go @@ -1,7 +1,6 @@ package define import ( - "math" "strings" "github.com/pkg/errors" @@ -18,11 +17,6 @@ const ( ExecErrorCodeCannotInvoke = 126 // ExecErrorCodeNotFound is the error code to return when a command cannot be found ExecErrorCodeNotFound = 127 - // ErrorConmonRead is a bogus value that can neither be a valid PID or exit code. It is - // used because conmon will send a negative value when sending a PID back over a pipe FD - // to signify something went wrong in the runtime. We need to differentiate between that - // value and a failure on the podman side of reading that value. Thus, we use ErrorConmonRead - ErrorConmonRead = math.MinInt32 - 1 ) // TranslateExecErrorToExitCode takes an error and checks whether it diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index f260e3a39..8da6db09f 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -1557,7 +1557,7 @@ func readConmonPipeData(pipe *os.File, ociLog string) DataAndErr { ch <- syncStruct{si: si} }() - data := define.ErrorConmonRead + data := -1 select { case ss := <-ch: if ss.err != nil { @@ -1567,14 +1567,14 @@ func readConmonPipeData(pipe *os.File, ociLog string) DataAndErr { var ociErr ociError if err := json.Unmarshal(ociLogData, &ociErr); err == nil { return DataAndErr{ - data: data, + data: -1, err: getOCIRuntimeError(ociErr.Msg), } } } } return DataAndErr{ - data: data, + data: -1, err: errors.Wrapf(ss.err, "container create failed (no logs from conmon)"), } } @@ -1607,7 +1607,7 @@ func readConmonPipeData(pipe *os.File, ociLog string) DataAndErr { data = ss.si.Data case <-time.After(define.ContainerCreateTimeout): return DataAndErr{ - data: data, + data: -1, err: errors.Wrapf(define.ErrInternal, "container creation timeout"), } } |