diff options
Diffstat (limited to 'libgo/go/syscall/pwd_plan9.go')
-rw-r--r-- | libgo/go/syscall/pwd_plan9.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libgo/go/syscall/pwd_plan9.go b/libgo/go/syscall/pwd_plan9.go index 1248613..1deeaa9 100644 --- a/libgo/go/syscall/pwd_plan9.go +++ b/libgo/go/syscall/pwd_plan9.go @@ -39,6 +39,15 @@ func fixwdLocked() { } } +func fixwd(paths ...string) { + for _, path := range paths { + if path != "" && path[0] != '/' && path[0] != '#' { + Fixwd() + return + } + } +} + // goroutine-specific getwd func getwd() (wd string, err error) { fd, err := open(".", O_RDONLY) @@ -66,6 +75,7 @@ func Getwd() (wd string, err error) { } func Chdir(path string) error { + fixwd(path) wdmu.Lock() defer wdmu.Unlock() |