add integration test for --workdir=/

Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
This commit is contained in:
Tibor Vass 2014-06-24 12:53:53 -04:00
parent 517b10352f
commit 09930dae8f

View file

@ -27,13 +27,12 @@ func FollowSymlinkInScope(link, root string) (string, error) {
return root, nil
}
if !strings.HasPrefix(filepath.Dir(link), root) {
return "", fmt.Errorf("%s is not within %s", link, root)
}
prev := "/"
for _, p := range strings.Split(link, "/") {
prev = filepath.Join(prev, p)
prev = filepath.Clean(prev)