Unlink docker init files

Upstream-commit: 29fa1b6666f28e7f42e92a10d195823fa84b7622
Component: engine
This commit is contained in:
Michael Crosby
2013-11-12 16:59:37 -08:00
parent c579e87812
commit ea7ee7989a

View File

@ -11,6 +11,7 @@ import (
"path"
"path/filepath"
"strings"
"syscall"
"time"
)
@ -212,6 +213,13 @@ func setupInitLayer(initLayer string) error {
// "var/run": "dir",
// "var/lock": "dir",
} {
parts := strings.Split(pth, "/")
prev := "/"
for _, p := range parts[1:] {
prev = path.Join(prev, p)
syscall.Unlink(path.Join(initLayer, prev))
}
if _, err := os.Stat(path.Join(initLayer, pth)); err != nil {
if os.IsNotExist(err) {
switch typ {