mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct/system: Exec: wrap the error
If the container binary to be run is removed in between runc create and runc start, the latter spits the following error: > can't exec user process: no such file or directory This is a bit confusing since we don't see what file is missing. Wrap the unix.Exec error into os.PathError, like in many other cases, to provide some context. Remove the error wrapping from (*linuxStandardInit).Init as it is now redundant. With this patch, the error is now: > exec /bin/false: no such file or directory Reported-by: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"unsafe"
|
||||
|
||||
@@ -43,7 +44,7 @@ func Exec(cmd string, args []string, env []string) error {
|
||||
for {
|
||||
err := unix.Exec(cmd, args, env)
|
||||
if err != unix.EINTR { //nolint:errorlint // unix errors are bare
|
||||
return err
|
||||
return &os.PathError{Op: "exec", Path: cmd, Err: err}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user