aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_freebsd_test.go')
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_freebsd_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
index 654439e..0fec1a8 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
@@ -295,3 +295,18 @@ func TestCapRightsSetAndClear(t *testing.T) {
t.Fatalf("Wrong rights set")
}
}
+
+// stringsFromByteSlice converts a sequence of attributes to a []string.
+// On FreeBSD, each entry consists of a single byte containing the length
+// of the attribute name, followed by the attribute name.
+// The name is _not_ NULL-terminated.
+func stringsFromByteSlice(buf []byte) []string {
+ var result []string
+ i := 0
+ for i < len(buf) {
+ next := i + 1 + int(buf[i])
+ result = append(result, string(buf[i+1:next]))
+ i = next
+ }
+ return result
+}