Commit d36c095d authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys Committed by Russ Cox

os: make POSIX StartProcess work with chroot again.

Skip directory check in startProcess in the presence of
SysProcAttr.

Fixes #3649.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6297083
parent 835f6a37
...@@ -19,9 +19,10 @@ var ( ...@@ -19,9 +19,10 @@ var (
) )
func startProcess(name string, argv []string, attr *ProcAttr) (p *Process, err error) { func startProcess(name string, argv []string, attr *ProcAttr) (p *Process, err error) {
// Double-check existence of the directory we want // If there is no SysProcAttr (ie. no Chroot or changed
// UID/GID), double-check existence of the directory we want
// to chdir into. We can make the error clearer this way. // to chdir into. We can make the error clearer this way.
if attr != nil && attr.Dir != "" { if attr != nil && attr.Sys == nil && attr.Dir != "" {
if _, err := Stat(attr.Dir); err != nil { if _, err := Stat(attr.Dir); err != nil {
pe := err.(*PathError) pe := err.(*PathError)
pe.Op = "chdir" pe.Op = "chdir"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment