]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: ignore getwd errors when fixing working directory on Plan 9
authorDavid du Colombier <0intro@gmail.com>
Sat, 11 Apr 2015 12:58:42 +0000 (14:58 +0200)
committerDavid du Colombier <0intro@gmail.com>
Sun, 12 Apr 2015 17:37:30 +0000 (17:37 +0000)
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>
src/syscall/pwd_plan9.go

index f8cafad92e8717a4e69d83292249595805042c51..12486135f0df8ce2774d0d69ad34a2b5ea94b240 100644 (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
        }