mirror of
https://github.com/containers/podman.git
synced 2025-10-18 03:33:32 +08:00
Exec: use ErrorConmonRead
Before, we were using -1 as a bogus value in podman to signify something went wrong when reading from a conmon pipe. However, conmon uses negative values to indicate the runtime failed, and return the runtime's exit code. instead, we should use a bogus value that is actually bogus. Define that value in the define package as MinInt32 (-1<< 31 - 1), which is outside of the range of possible pids (-1 << 31) Signed-off-by: Peter Hunt <pehunt@redhat.com>
This commit is contained in:
@ -1557,7 +1557,7 @@ func readConmonPipeData(pipe *os.File, ociLog string) DataAndErr {
|
||||
ch <- syncStruct{si: si}
|
||||
}()
|
||||
|
||||
data := -1
|
||||
data := define.ErrorConmonRead
|
||||
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: -1,
|
||||
data: data,
|
||||
err: getOCIRuntimeError(ociErr.Msg),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DataAndErr{
|
||||
data: -1,
|
||||
data: data,
|
||||
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: -1,
|
||||
data: data,
|
||||
err: errors.Wrapf(define.ErrInternal, "container creation timeout"),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user