Only set cwd when not empty

For existing consumers of libconatiner to not require cwd inside the
libcontainer code.  This can be done at the runc level and is already
evaluated there.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-01-21 11:08:32 -08:00
parent 986637c97a
commit ed7be1d082
1 changed files with 4 additions and 2 deletions

View File

@ -134,8 +134,10 @@ func finalizeNamespace(config *initConfig) error {
if err := w.drop(); err != nil {
return err
}
if err := syscall.Chdir(config.Cwd); err != nil {
return err
if config.Cwd != "" {
if err := syscall.Chdir(config.Cwd); err != nil {
return err
}
}
return nil
}