remove setupDev from libcontainer
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
This commit is contained in:
parent
949877915f
commit
f99f51db37
|
@ -62,9 +62,6 @@ func setupNewMountNamespace(rootfs string, bindMounts []libcontainer.Mount, cons
|
||||||
}
|
}
|
||||||
// In non-privileged mode, this fails. Discard the error.
|
// In non-privileged mode, this fails. Discard the error.
|
||||||
setupLoopbackDevices(rootfs)
|
setupLoopbackDevices(rootfs)
|
||||||
if err := setupDev(rootfs); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := setupPtmx(rootfs, console, mountLabel); err != nil {
|
if err := setupPtmx(rootfs, console, mountLabel); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -172,30 +169,6 @@ func copyDevNode(rootfs, node string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// setupDev symlinks the current processes pipes into the
|
|
||||||
// appropriate destination on the containers rootfs
|
|
||||||
func setupDev(rootfs string) error {
|
|
||||||
for _, link := range []struct {
|
|
||||||
from string
|
|
||||||
to string
|
|
||||||
}{
|
|
||||||
{"/proc/kcore", "/dev/core"},
|
|
||||||
{"/proc/self/fd", "/dev/fd"},
|
|
||||||
{"/proc/self/fd/0", "/dev/stdin"},
|
|
||||||
{"/proc/self/fd/1", "/dev/stdout"},
|
|
||||||
{"/proc/self/fd/2", "/dev/stderr"},
|
|
||||||
} {
|
|
||||||
dest := filepath.Join(rootfs, link.to)
|
|
||||||
if err := os.Remove(dest); err != nil && !os.IsNotExist(err) {
|
|
||||||
return fmt.Errorf("remove %s %s", dest, err)
|
|
||||||
}
|
|
||||||
if err := os.Symlink(link.from, dest); err != nil {
|
|
||||||
return fmt.Errorf("symlink %s %s", dest, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// setupConsole ensures that the container has a proper /dev/console setup
|
// setupConsole ensures that the container has a proper /dev/console setup
|
||||||
func setupConsole(rootfs, console string, mountLabel string) error {
|
func setupConsole(rootfs, console string, mountLabel string) error {
|
||||||
oldMask := system.Umask(0000)
|
oldMask := system.Umask(0000)
|
||||||
|
|
Loading…
Reference in New Issue