containerfs.go 416 B

12345678910111213
  1. package containerfs // import "github.com/docker/docker/pkg/containerfs"
  2. import (
  3. "path/filepath"
  4. "github.com/moby/sys/symlink"
  5. )
  6. // ResolveScopedPath evaluates the given path scoped to the root.
  7. // For example, if root=/a, and path=/b/c, then this function would return /a/b/c.
  8. func ResolveScopedPath(root, path string) (string, error) {
  9. return symlink.FollowSymlinkInScope(filepath.Join(root, path), root)
  10. }