reexec: Use in-memory binary on linux instead of os.Args[0]

This keeps reexec working properly even if the on-disk binary was replaced.

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2015-07-24 13:51:51 -04:00
parent 0cec613de9
commit 264e16318f
3 changed files with 15 additions and 4 deletions

View file

@ -30,8 +30,7 @@ func Init() bool {
return false
}
// Self returns the path to the current processes binary
func Self() string {
func naiveSelf() string {
name := os.Args[0]
if filepath.Base(name) == name {
if lp, err := exec.LookPath(name); err == nil {