1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-29 13:49:21 +08:00

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.
This commit is contained in:
Marco Pfatschbacher 2017-11-08 20:52:36 +01:00
parent 48fc561289
commit d62768abc9

View File

@ -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
}