linux: Don't prepend process' cwd if rootfs path is already absolute

If I provide a path starting with `/` I expect that to be honored;
otherwise I have to explicitly `(cd /; /path/to/runc)`.

Signed-off-by: Colin Walters <walters@redhat.com>
This commit is contained in:
Colin Walters 2015-06-26 14:07:00 -04:00 committed by Colin Walters
parent cc16e6b032
commit 83d503e9d7
1 changed files with 5 additions and 1 deletions

View File

@ -123,9 +123,13 @@ func createLibcontainerConfig(spec *LinuxSpec) (*configs.Config, error) {
if err != nil {
return nil, err
}
rootfsPath := spec.Root.Path
if !filepath.IsAbs(rootfsPath) {
rootfsPath = filepath.Join(cwd, rootfsPath)
}
config := &configs.Config{
Capabilities: spec.Capabilities,
Rootfs: filepath.Join(cwd, spec.Root.Path),
Rootfs: rootfsPath,
Readonlyfs: spec.Root.Readonly,
Hostname: spec.Hostname,
Privatefs: true,