Skip to content

Commit 753b731

Browse files
committed
inline execve
1 parent a8df137 commit 753b731

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tools/container/wrapper/wrapper.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,16 @@ func main() {
4242
}
4343
argv := []string{"runc"}
4444
argv = append(argv, os.Args[1:]...)
45-
execve(program, argv, os.Environ())
45+
if err := unix.Exec(program, argv, os.Environ()); err != nil {
46+
log.Fatalf("failed to exec %s: %v", program, err)
47+
}
4648
}
4749
argv := makeArgv(program)
4850
envv := makeEnvv(program)
49-
execve(program+".real", argv, envv)
51+
if err := unix.Exec(program+".real", argv, envv); err != nil {
52+
log.Fatalf("failed to exec %s: %v", program+".real", err)
53+
}
54+
5055
}
5156

5257
func isRuntimeWrapper(program string) bool {
@@ -107,9 +112,3 @@ func makeEnvv(program string) []string {
107112
}
108113
return append(env, os.Environ()...)
109114
}
110-
111-
func execve(program string, argv []string, envv []string) {
112-
if err := unix.Exec(program, argv, envv); err != nil {
113-
log.Fatalf("failed to exec %s: %v", program, err)
114-
}
115-
}

0 commit comments

Comments
 (0)