Commit ad119b9c authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

os: fix plan9 build

I broke it with the darwin getwd attrlist stuff (0583e9d36dd).
plan9 doesn't have syscall.ENOTSUP.

It's in api/go1.txt as a symbol always available (not context-specific):

pkg syscall, const ENOTSUP Errno

... but plan9 isn't considered by cmd/api, so it only looks
universally available.  Alternatively, we could add a fake ENOTSUP
to plan9, but they were making efforts earlier to clean their
syscall package, so I'd prefer not to dump more in it.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12509044
parent 91153459
...@@ -14,6 +14,10 @@ var getwdCache struct { ...@@ -14,6 +14,10 @@ var getwdCache struct {
dir string dir string
} }
// useSyscallwd determines whether to use the return value of
// syscall.Getwd based on its error.
var useSyscallwd = func(error) bool { return true }
// Getwd returns a rooted path name corresponding to the // Getwd returns a rooted path name corresponding to the
// current directory. If the current directory can be // current directory. If the current directory can be
// reached via multiple paths (due to symbolic links), // reached via multiple paths (due to symbolic links),
...@@ -22,7 +26,7 @@ func Getwd() (pwd string, err error) { ...@@ -22,7 +26,7 @@ func Getwd() (pwd string, err error) {
// If the operating system provides a Getwd call, use it. // If the operating system provides a Getwd call, use it.
if syscall.ImplementsGetwd { if syscall.ImplementsGetwd {
s, e := syscall.Getwd() s, e := syscall.Getwd()
if e != syscall.ENOTSUP { if useSyscallwd(e) {
return s, NewSyscallError("getwd", e) return s, NewSyscallError("getwd", e)
} }
} }
......
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package os
import "syscall"
func init() {
useSyscallwd = useSyscallwdDarwin
}
func useSyscallwdDarwin(err error) bool {
return err != syscall.ENOTSUP
}
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