From 7d3fd4f3c46e57c703128bbabb385424f338d6d9 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 25 Sep 2020 18:06:26 +0200 Subject: syscall: implement Getwd using getcwd from libSystem on darwin Directly wrap the getcwd implementation provided by libSystem.dylib on darwin and use it to implement Getwd like on the BSDs. This allows to drop the custom implementation using getAttrList and to merge the implementation of Getwd for darwin and the BSDs in syscall_bsd.go. Same as CL 257497 did for golang.org/x/sys/unix Change-Id: If30390c4c17cd463bb8fdcb5465f40d6fa11f391 Reviewed-on: https://go-review.googlesource.com/c/go/+/257637 Trust: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- src/syscall/syscall_getwd_bsd.go | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 src/syscall/syscall_getwd_bsd.go (limited to 'src/syscall/syscall_getwd_bsd.go') diff --git a/src/syscall/syscall_getwd_bsd.go b/src/syscall/syscall_getwd_bsd.go deleted file mode 100644 index b14367936e..0000000000 --- a/src/syscall/syscall_getwd_bsd.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 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. - -// +build dragonfly freebsd netbsd openbsd - -package syscall - -const ImplementsGetwd = true - -func Getwd() (string, error) { - var buf [pathMax]byte - _, err := getcwd(buf[:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} -- cgit v1.3