summaryrefslogtreecommitdiff
path: root/libpod/container_api.go
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2020-03-03 15:35:29 -0500
committerPeter Hunt <pehunt@redhat.com>2020-03-03 15:43:31 -0500
commitd3d97a25e8c87cf741b2e24ac01ef84962137106 (patch)
treead8bde2cc012fb4fdb01c80d12e93a04badd4300 /libpod/container_api.go
parent4b72f9e4013411208751df2a92ab9f322d4da5b2 (diff)
downloadpodman-d3d97a25e8c87cf741b2e24ac01ef84962137106.tar.gz
podman-d3d97a25e8c87cf741b2e24ac01ef84962137106.tar.bz2
podman-d3d97a25e8c87cf741b2e24ac01ef84962137106.zip
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>
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r--libpod/container_api.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 37a05bb75..356da12d0 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -297,7 +297,9 @@ 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.
- if pid < 0 {
+ // 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 {
ec = -1 * pid
}
return ec, err