1
0
mirror of https://github.com/golang/go synced 2024-10-03 20:31:22 -06:00

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
This commit is contained in:
Han-Wen Nienhuys 2012-06-24 19:34:06 -04:00 committed by Russ Cox
parent 835f6a37dc
commit d36c095da9

View File

@ -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"