syscall: ignore getwd errors when fixing working directory on Plan 9

In Plan 9, goroutines can run in different processes,
which don't share their working directory. However,
Go expects the working directory to be program-wide.

We use a Fixwd function to fix the working directory
before calling system calls which depend on the
working directory.

In fixwdLocked, the working directory is not fixed
when getwd returns an error. However, an error can
happen is some cases, notably when the directory
has been previously removed in another process.

Fixes #10422.

Change-Id: Ie0c36f97c4b5ebe27ff0ead360987c5b35f825e4
Reviewed-on: https://go-review.googlesource.com/8800
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
David du Colombier 2015-04-11 14:58:42 +02:00
parent 63c16b1878
commit 7d3f81a9f3
1 changed files with 2 additions and 4 deletions

View File

@ -29,10 +29,8 @@ func fixwdLocked() {
if !wdSet {
return
}
wd, err := getwd()
if err != nil {
return
}
// always call chdir when getwd returns an error
wd, _ := getwd()
if wd == wdStr {
return
}