merge branch 'pr-2086'

* Kurnia D Win (1):
  fix permission denied

LGTMs: @crosbymichael @cyphar
Closes #2086
This commit is contained in:
Aleksa Sarai 2019-12-17 20:49:52 +11:00
commit 7496a96825
No known key found for this signature in database
GPG Key ID: 9E18AA267DDB8DB4
1 changed files with 6 additions and 5 deletions

View File

@ -127,6 +127,12 @@ func finalizeNamespace(config *initConfig) error {
return errors.Wrap(err, "close exec fds") return errors.Wrap(err, "close exec fds")
} }
if config.Cwd != "" {
if err := unix.Chdir(config.Cwd); err != nil {
return fmt.Errorf("chdir to cwd (%q) set in config.json failed: %v", config.Cwd, err)
}
}
capabilities := &configs.Capabilities{} capabilities := &configs.Capabilities{}
if config.Capabilities != nil { if config.Capabilities != nil {
capabilities = config.Capabilities capabilities = config.Capabilities
@ -154,11 +160,6 @@ func finalizeNamespace(config *initConfig) error {
if err := w.ApplyCaps(); err != nil { if err := w.ApplyCaps(); err != nil {
return errors.Wrap(err, "apply caps") return errors.Wrap(err, "apply caps")
} }
if config.Cwd != "" {
if err := unix.Chdir(config.Cwd); err != nil {
return fmt.Errorf("chdir to cwd (%q) set in config.json failed: %v", config.Cwd, err)
}
}
return nil return nil
} }