]> Cypherpunks repositories - gostls13.git/commitdiff
os: make POSIX StartProcess work with chroot again.
authorHan-Wen Nienhuys <hanwen@google.com>
Sun, 24 Jun 2012 23:34:06 +0000 (19:34 -0400)
committerRuss Cox <rsc@golang.org>
Sun, 24 Jun 2012 23:34:06 +0000 (19:34 -0400)
Skip directory check in startProcess in the presence of
SysProcAttr.

Fixes #3649.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6297083

src/pkg/os/exec_posix.go

index 2feec480d72a864def176e8d31a7215723b4befa..2ced4d673b85219763e6152884ba584bedb00905 100644 (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"