summaryrefslogtreecommitdiff
path: root/libpod/define/exec_codes.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/define/exec_codes.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/define/exec_codes.go')
-rw-r--r--libpod/define/exec_codes.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/libpod/define/exec_codes.go b/libpod/define/exec_codes.go
index f94616b33..c2ec08666 100644
--- a/libpod/define/exec_codes.go
+++ b/libpod/define/exec_codes.go
@@ -1,6 +1,7 @@
package define
import (
+ "math"
"strings"
"github.com/pkg/errors"
@@ -17,6 +18,11 @@ 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