]> Cypherpunks repositories - gostls13.git/commitdiff
os: remove ENOTSUP special case in Getwd on darwin
authorTobias Klauser <tklauser@distanz.ch>
Sat, 26 Sep 2020 15:12:14 +0000 (17:12 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Mon, 28 Sep 2020 06:28:02 +0000 (06:28 +0000)
ENOTSUP was used as a signaling error in the custom implementation of
syscall.Getwd to fall back to the slow algorithm. Since CL 257637 Getwd
directly calls the respective function from libSystem.dylib which can no
longer return ENOTSUP.

Change-Id: I8e65e42b3ea069bf78969a29f2af1c55552e2949
Reviewed-on: https://go-review.googlesource.com/c/go/+/257644
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/getwd.go
src/os/getwd_darwin.go [deleted file]

index f373ce937da5ce517f37f293b86f9f92a3da39cc..90604cf2f4b18e57a04cdcf5f559b61a0ef0be3e 100644 (file)
@@ -15,10 +15,6 @@ var getwdCache struct {
        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
 // current directory. If the current directory can be
 // reached via multiple paths (due to symbolic links),
@@ -55,9 +51,7 @@ func Getwd() (dir string, err error) {
                                break
                        }
                }
-               if useSyscallwd(e) {
-                       return s, NewSyscallError("getwd", e)
-               }
+               return s, NewSyscallError("getwd", e)
        }
 
        // Apply same kludge but to cached dir instead of $PWD.
diff --git a/src/os/getwd_darwin.go b/src/os/getwd_darwin.go
deleted file mode 100644 (file)
index e51ffcd..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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
-}