Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions stage1_fly/run/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,17 @@ func stage1(rp *stage1commontypes.RuntimePod) int {
return 254
}

// syscall.Exec takes a path and not a command name, so in the event that args[0] is a command name we have to convert it into a path
path, err := stage1initcommon.FindBinPath(p, &ra)
if err != nil {
log.PrintE(fmt.Sprintf("can't find the absolute executable for %q", args[0]), err)
return 254
}
if path != args[0] {
diag.Printf("converting args[0] (%q) into an absolute path: %q", args[0], path)
args[0] = path
}

diag.Printf("chroot to %q", rfs)
if err := syscall.Chroot(rfs); err != nil {
log.PrintE("can't chroot", err)
Expand Down