Skip to content

Commit

Permalink
merge branch 'pr-2086'
Browse files Browse the repository at this point in the history
* Kurnia D Win (1):
  fix permission denied

LGTMs: @crosbymichael @cyphar
Closes opencontainers#2086
  • Loading branch information
cyphar committed Dec 17, 2019
2 parents 201b063 + 5e0e67d commit 7496a96
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions libcontainer/init_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ func finalizeNamespace(config *initConfig) error {
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{}
if config.Capabilities != nil {
capabilities = config.Capabilities
Expand Down Expand Up @@ -154,11 +160,6 @@ func finalizeNamespace(config *initConfig) error {
if err := w.ApplyCaps(); err != nil {
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
}

Expand Down

0 comments on commit 7496a96

Please sign in to comment.