From: Han-Wen Nienhuys Date: Fri, 21 Sep 2012 19:53:47 +0000 (+1000) Subject: [release-branch.go1] os: make POSIX StartProcess work with chroot again. X-Git-Tag: go1.0.3~194 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fd70e5dd66b801abcaec16f9667d3663cb27b2d7;p=gostls13.git [release-branch.go1] os: make POSIX StartProcess work with chroot again. ««« backport 2aaa88600d48 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 70351cfb31..40fd0fd0ee 100644 --- a/src/pkg/os/exec_posix.go +++ b/src/pkg/os/exec_posix.go @@ -11,9 +11,10 @@ import ( ) 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"