From a26fa11ef61157198af1ec6a15440ed9d006cf8a Mon Sep 17 00:00:00 2001 From: Yuval Pavel Zholkover Date: Fri, 21 Jun 2019 21:09:53 +0300 Subject: [PATCH] unix: fix Getdirentries emulation using Getdents on netbsd, openbsd CL 182319 used the wrong shift offset, correct and enable the TestGetdirentries. Change-Id: I45d8d420a071fd79fa1b37642b984d80943f492b Reviewed-on: https://go-review.googlesource.com/c/sys/+/183221 Reviewed-by: Tobias Klauser Run-TryBot: Tobias Klauser Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- unix/getdirentries_test.go | 2 +- unix/syscall_netbsd.go | 2 +- unix/syscall_openbsd.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/getdirentries_test.go b/unix/getdirentries_test.go index 16250bd6..87819e70 100644 --- a/unix/getdirentries_test.go +++ b/unix/getdirentries_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly +// +build darwin dragonfly freebsd openbsd netbsd package unix_test diff --git a/unix/syscall_netbsd.go b/unix/syscall_netbsd.go index 8f4c320e..45377107 100644 --- a/unix/syscall_netbsd.go +++ b/unix/syscall_netbsd.go @@ -137,7 +137,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { if unsafe.Sizeof(*basep) == 8 { return } - if off>>4 != 0 { + if off>>32 != 0 { // We can't stuff the offset back into a uintptr, so any // future calls would be suspect. Generate an error. // EIO is allowed by getdirentries. diff --git a/unix/syscall_openbsd.go b/unix/syscall_openbsd.go index 276c93be..4f34d6d0 100644 --- a/unix/syscall_openbsd.go +++ b/unix/syscall_openbsd.go @@ -106,7 +106,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { if unsafe.Sizeof(*basep) == 8 { return } - if off>>4 != 0 { + if off>>32 != 0 { // We can't stuff the offset back into a uintptr, so any // future calls would be suspect. Generate an error. // EIO was allowed by getdirentries.