aboutsummaryrefslogtreecommitdiff
path: root/src/os/getwd.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/getwd.go')
-rw-r--r--src/os/getwd.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/os/getwd.go b/src/os/getwd.go
index f3afd8c06c..90604cf2f4 100644
--- a/src/os/getwd.go
+++ b/src/os/getwd.go
@@ -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.
@@ -112,10 +106,10 @@ func Getwd() (dir string, err error) {
Found:
pd, err := fd.Stat()
+ fd.Close()
if err != nil {
return "", err
}
- fd.Close()
if SameFile(pd, root) {
break
}