From d62768abc96623b8fd47173205abe129adfe8dc5 Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Wed, 8 Nov 2017 20:52:36 +0100 Subject: [PATCH] Fix IOCounters for OpenBSD Use SysctlRaw instead of Sysctl. The latter assumes NUL terminated strings which returns the lenght off by one. Therefore, only n-1 disks where reported. --- disk/disk_openbsd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk/disk_openbsd.go b/disk/disk_openbsd.go index d1705ea..348a1f1 100644 --- a/disk/disk_openbsd.go +++ b/disk/disk_openbsd.go @@ -66,7 +66,7 @@ func Partitions(all bool) ([]PartitionStat, error) { func IOCounters(names ...string) (map[string]IOCountersStat, error) { ret := make(map[string]IOCountersStat) - r, err := unix.Sysctl("hw.diskstats") + r, err := unix.SysctlRaw("hw.diskstats") if err != nil { return nil, err }