From: Han-Wen Nienhuys Date: Sun, 24 Jun 2012 23:34:06 +0000 (-0400) Subject: os: make POSIX StartProcess work with chroot again. X-Git-Tag: go1.1rc2~2896 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d36c095da920cffef16da7f37ce725f9a07f6ae0;p=gostls13.git 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 --- diff --git a/src/pkg/os/exec_posix.go b/src/pkg/os/exec_posix.go index 2feec480d7..2ced4d673b 100644 --- a/src/pkg/os/exec_posix.go +++ b/src/pkg/os/exec_posix.go @@ -19,9 +19,10 @@ var ( ) 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. - if attr != nil && attr.Dir != "" { + if attr != nil && attr.Sys == nil && attr.Dir != "" { if _, err := Stat(attr.Dir); err != nil { pe := err.(*PathError) pe.Op = "chdir"