Browse code

Use proc/exe for reexec

You don't need to resolve the symlink for the exec as long as the
process is to keep running during execution.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Michael Crosby authored on 2018/01/27 03:40:32
Showing 1 changed files
... ...
@@ -862,14 +862,10 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
862 862
 
863 863
 	for _, ns := range s.Linux.Namespaces {
864 864
 		if ns.Type == "network" && ns.Path == "" && !c.Config.NetworkDisabled {
865
-			target, err := os.Readlink(filepath.Join("/proc", strconv.Itoa(os.Getpid()), "exe"))
866
-			if err != nil {
867
-				return nil, err
868
-			}
869
-
865
+			target := filepath.Join("/proc", strconv.Itoa(os.Getpid()), "exe")
870 866
 			s.Hooks = &specs.Hooks{
871 867
 				Prestart: []specs.Hook{{
872
-					Path: target, // FIXME: cross-platform
868
+					Path: target,
873 869
 					Args: []string{"libnetwork-setkey", c.ID, daemon.netController.ID()},
874 870
 				}},
875 871
 			}