Commit 7d3f81a9 authored by David du Colombier's avatar David du Colombier

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/8800Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 63c16b18
...@@ -29,10 +29,8 @@ func fixwdLocked() { ...@@ -29,10 +29,8 @@ func fixwdLocked() {
if !wdSet { if !wdSet {
return return
} }
wd, err := getwd() // always call chdir when getwd returns an error
if err != nil { wd, _ := getwd()
return
}
if wd == wdStr { if wd == wdStr {
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment