diff options
author | Valentin Rothberg <vrothberg@suse.com> | 2018-10-05 14:36:27 +0200 |
---|---|---|
committer | Valentin Rothberg <vrothberg@suse.com> | 2018-10-05 17:28:18 +0200 |
commit | d4eca12cc12734f2b578e1b1967d69889c21c487 (patch) | |
tree | 872d4e8270a2778a4c995d30cd3011682b1ebfb2 /cmd/podman/shared/funcs.go | |
parent | 094b8b73505cb084d632ebb08e2a014e68f5e1b1 (diff) | |
download | podman-d4eca12cc12734f2b578e1b1967d69889c21c487.tar.gz podman-d4eca12cc12734f2b578e1b1967d69889c21c487.tar.bz2 podman-d4eca12cc12734f2b578e1b1967d69889c21c487.zip |
runlabel: execute /proc/self/exe and avoid recursion
Execute /proc/self/exe instead of podman. This makes the runlabel
command more portable as it works for binaries outside the path as
well as for local builds.
Also, avoid redundantly executing the runlabel command by setting
the PODMAN_RUNLABEL_NESTED environment variable to "1". Podman
now checks for this variable before executing the runlabel command
and will throw an error in case the variable is set.
Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
Diffstat (limited to 'cmd/podman/shared/funcs.go')
-rw-r--r-- | cmd/podman/shared/funcs.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cmd/podman/shared/funcs.go b/cmd/podman/shared/funcs.go index 5c401634c..21e7fe10d 100644 --- a/cmd/podman/shared/funcs.go +++ b/cmd/podman/shared/funcs.go @@ -15,9 +15,8 @@ func GenerateCommand(command, imageName, name string) []string { name = imageName } cmd := strings.Split(command, " ") - // Replace the first position of cmd with podman whether - // it is docker, /usr/bin/docker, or podman - newCommand = append(newCommand, "podman") + // Replace the first element of cmd with "/proc/self/exe" + newCommand = append(newCommand, "/proc/self/exe") for _, arg := range cmd[1:] { var newArg string switch arg { |