1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-26 13:48:59 +08:00

Merge pull request #1010 from gdbinit/openbsd-wrong-users-number-patch

Fix wrong OpenBSD user count
This commit is contained in:
shirou 2021-05-29 13:39:08 +09:00 committed by GitHub
commit 2782a109dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,7 @@ func UsersWithContext(ctx context.Context) ([]UserStat, error) {
var u Utmp
br := bytes.NewReader(b)
err := binary.Read(br, binary.LittleEndian, &u)
if err != nil || u.Time == 0 {
if err != nil || u.Time == 0 || u.Name[0] == 0 {
continue
}
user := UserStat{